PDA

View Full Version : 301 from one address without .com to one with .com ?


Saz
10-01-2009, 11:36 AM
Been trying to find an answer on the net somewhere, but have not been able to.

ok, if you wanted all hits on :

http://www.websitename/pagename

to go to

http://www.websitename.com/pagename/

and you didn't want to upset any search engines and not lose any pr, how would you do it please ?

Any help appreciated.

Saz.

charlesandrews
10-01-2009, 02:07 PM
How would http://www.websitename/pagename work without a TLD? I posted in another thread:

I haven't actually tested this, but from this mod_rewrite guide (http://www.openzu.com/Tips-&-Tricks/Apache-Mod-Rewrite/p-44/) I think you would want to use:

RewriteRule http://www.yourdomain.com/?redir=(.*) $1 [R=301,L]

Let me know if this works for you, if not we can try something different.

Which you could adapt sort of like:

RewriteRule http://www.websitename/(.*) http://www.websitename.com/$1

Saz
10-01-2009, 04:20 PM
Many thanks Charles, that's worked a dream - cheers. :thumbsup:

One last thing, to redirect a user from a particular IP address to another page on the same website, I'm trying :
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^92\.53\.62\.24$ [OR]
RewriteCond %{REMOTE_ADDR} ^24\.151\.467\.151$
RewriteRule ^(.*)$ http://www.websitename.com/folder/index.php [L]

But, it's not working ? ? :confused:

Any help appreciated.

Saz