Soldato
- Joined
- 12 Feb 2006
- Posts
- 17,417
- Location
- Surrey
i'm no good with htaccess it would appear. everything i try doesn't work so hoping someone can help me out.
this is what i have got that my hosting company put to make it so the website root is within a folder public_html/grp, rather than just public_html (i need this to keep my shared hosting account tidy)
what i want now is 2 things.
1. Make it so that if someone goes to the website without www., it redirects them to the site with www.
2. if someone goes to the link www.mayergroup.co.uk/grp it shows the home page. i'd like it so they are redirected to www.mayergroup.co.uk.
i thought the below would do that, but in fact the last line is doing the opposite, so redirecting when there is no www., to www.mayergroup.co.uk/grp.
what do i need to do?
this is what i have got that my hosting company put to make it so the website root is within a folder public_html/grp, rather than just public_html (i need this to keep my shared hosting account tidy)
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mayergroup\.co.uk$
RewriteRule !^grp/ /grp%{REQUEST_URI} [L]
what i want now is 2 things.
1. Make it so that if someone goes to the website without www., it redirects them to the site with www.
2. if someone goes to the link www.mayergroup.co.uk/grp it shows the home page. i'd like it so they are redirected to www.mayergroup.co.uk.
i thought the below would do that, but in fact the last line is doing the opposite, so redirecting when there is no www., to www.mayergroup.co.uk/grp.
Code:
RewriteCond %{HTTP_HOST} ^mayergroup\.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.mayergroup.co.uk/$1 [R=301,L]
redirect 301 [url]http://www.mayergroup.co.uk/grp/[/url] [url]http://www.mayergroup.co.uk/[/url]
what do i need to do?