Buy Anything On eBay - Xbox Mod Chip - Homeowner Loan - Remortgages - Personalized Gifts

PDA

View Full Version : redirect on same server


travisb
Nov 9th 2004, 9:57 am
I have oldsite.com and just added newsite.com. I want to phase out the use of oldsite.com. I would like for everyone (and search engines) to redirect from oldsite.com/anypage.html to the same page on newsite.com.

I tried using an .htaccess file like this:
Redirect permanent / http://www.newsite.com/
but got errors about exceeding the limit of redirects.

Both sites are on the same server so they both get the .htaccess file, which I guess is causing the problem. How can I get around this?

digitalpoint
Nov 9th 2004, 10:02 am
Check this thread.

travisb
Nov 9th 2004, 10:45 am
Ok, so do I put this in a .htaccess file? I tried this but it did not do anything when going to the top level of the site. The urls stayed the same. Going deeper in the site produced 404s on both the new and old site.

<VirtualHost 65.18.***.***>
ServerName www.newsite.com
ServerAlias www.oldsite.com oldsite.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^65.18.***.***(:80)?$
RewriteCond %{HTTP_HOST} !^www.newsite.com(:80)?$
RewriteRule ^/(.*) http://www.newsite.com/$1 [L,R=301]
</VirtualHost>

digitalpoint
Nov 9th 2004, 10:56 am
No, that example would be for your httpd.conf file. Although it could be modified a bit for use in an .htaccess file.

Also, for the record, your problem isn't that you are redirecting to the same server, it's a problem because you are redirecting to the same SITE, and specifically redirecting to the same page. So it runs itself into a redirection loop.

Andre
Nov 23rd 2004, 12:02 pm
mod_redirect might be a good solution.