jasonpc1
05-22-2011, 09:02 AM
how do i make it so visitors get rerected from site.com to www.site.com so visitors only use the www.site.com
been told that i need to add something to the .htaccess file to make this so.
what is this ?
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
jasonpc1
05-22-2011, 09:53 AM
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule ^(.*)$ http://www.site.com/ [R=301,L]
thank you, but how do i get the visitor to be sent to the page they were trying to view first
say they type in
site.com/mypage.html they get sent to www.site.com
Check again the rewrite rule (it needs a $1 after the destination url).
jasonpc1
05-22-2011, 10:08 AM
sorry this has gone over my head, all i done was copied to code you gave to the top of my .htaccess page and changed the domain names
where do i put the $1 ?
jasonpc1
05-22-2011, 10:47 AM
ok i see i did not have the $1 after the /
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
but still i am always taken to the home page being www.site.com
if i was to visit say
site.com/mypage.html i would like the visitor taken to www.site.com/mypage.html
same for
site.com/anotherpage.html would take them to www.site.com/anotherpage.html
and finally site.com/anotherfolder would take them to www.site/anotherfolder
The rewrite rule is correct. Restart your web server and try again.