View Full Version : http://www.domain.com http://domain.com http://www.domain.com/idex.htm etc
Jayess
Jan 11th 2005, 5:48 am
When google finds http://domain.com I want to push it to http://www.domain.com
Likewise when it finds http://www.domain.com/index.htm i want to push it to http://www.domain.com
Basically all of these variations I want to push to http://www.domain.com
http://www.domain.com/index.htm
http://domain.com/index.htm
http://domain.com/
How?
I've seen a htaccess script, but it did it the other way around (pushing http://www to http://
Hope someone can guide me.
johnt
Jan 11th 2005, 9:23 am
Try the following in your .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent]
RewriteRule ^/index.html$ http://www.domain.com [R=permanent, L]
The first rule should redirect every request for domain.com/file.ext to www.domain.com/file.ext
The second redirects /index.html, with or without www, to www.domain.com
You may need to play about with it a bit, but I think that this should do what you're after.
Cheers
John
Jayess
Jan 11th 2005, 1:26 pm
Try the following in your .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent]
RewriteRule ^/index.html$ http://www.domain.com [R=permanent, L]
The first rule should redirect every request for domain.com/file.ext to www.domain.com/file.ext
The second redirects /index.html, with or without www, to www.domain.com
You may need to play about with it a bit, but I think that this should do what you're after.
Cheers
John
500 error!
I obviously changed the domain.com to my own domain and the index.html to my page name.....Any ideas?
johnt
Jan 12th 2005, 2:02 am
It's the last line, rewriting index.html, that is wrong, but I can't get it to work either I'm afraid.
If you remove that line, then it will correctly redirect from domain.com to www.domain.com, but that still leaves you with the problem on index.html
Anyone else ?
John
Jayess
Jan 12th 2005, 5:40 am
It's the last line, rewriting index.html, that is wrong, but I can't get it to work either I'm afraid.
If you remove that line, then it will correctly redirect from domain.com to www.domain.com, but that still leaves you with the problem on index.html
Anyone else ?
John
The first part(s) do indeed work, thank you. Anyone else know how to move a user/robot from index.html to the root of the domain?
Volknet
Jan 19th 2005, 4:09 pm
I want to do a similar thing but all www. volknet .com requests to be pushed to http:// volknet .com
So would this work:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://domain.com/$1 [R=permanent]
?
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.