Results 1 to 7 of 7
Thread: mod_rewrite question
-
02-11-2004, 12:22 AM #1Newbie
- Join Date
- Dec 2003
- Posts
- 14
mod_rewrite question
I'm switching servers and changing names all at the same time.
I want to use a mod_rewrite to seemlessly transfer my visitors to the new site as well as help keep some of my PR and Links.
Anyways, I set up an .htaccess file as:
RewriteEngine On
RewriteRule ^(.*)$ http://www.newserver/$1 [R=301,L]
But there is a problem! My old server used a public folder of /HTML and my new server uses /public_html
Is there a conditional that I can throw into my .htaccess file to switch folders AND Redirect?
Thanks!
-
02-11-2004, 01:02 AM #2Junior Guru
- Join Date
- Oct 2003
- Posts
- 200
What's wrong with a simple: redirect / http:newdomain.com in the .htaccess file?
The public folder really doesn't matter to your visitors. They can only see what's in the public_html folder.
-
02-11-2004, 11:17 AM #3Newbie
- Join Date
- Dec 2003
- Posts
- 14
Redirects don't work for your whole site.
mod_rewrite allows you to redirect your whole site and also allows Spiders to follow links better.
Example: oldsite.com/forum/showthread.php?s=&threadid=235530 will automatically go to newsite.com/forum/showthread.php?s=&threadid=235530
Right?
-
02-11-2004, 12:37 PM #4learning is in the doing
- Join Date
- Sep 2000
- Location
- Alberta, Canada
- Posts
- 3,146
kb9tyc, is giving some good advice. The only thing I would do different is:
Redirect Permanent / http://newdomain.com
Dont' know where you got the idea that Redirect does not work for a whole site? There is also the fact that a RewriteRule is backwards compatiable (URL doesn't change on the redirection) and SEs will not update their listings. With the Redirect they will.• PotentProducts.com - for all your Hosting needs
• Helping people Host, Create and Maintain their Web Site
• ServerAdmin Services also available
-
02-11-2004, 12:48 PM #5Newbie
- Join Date
- Dec 2003
- Posts
- 14
Unless I've missunderstood here is the difference:
The redirect will forward the whole site but only to one page.
So - OldSite.com/forums/thread55 will be forwarded to NewSite.com
The mod_rewrite will forward individual pages to the new sites corresponding page.
So - OldSite.com/forums/thread55 will be forwarded to NewSite.com/forums/thread55
I got my info by the way from: http://www.tamingthebeast.net/articl...main-names.htm
If I'm not understanding this correctly please let me know.
Nathan
-
02-11-2004, 03:56 PM #6Junior Guru
- Join Date
- Oct 2003
- Posts
- 200
The redirect should work with any page in the site. I have done this many times.
-
02-11-2004, 04:11 PM #7Newbie
- Join Date
- Dec 2003
- Posts
- 14
OK, I'll test it out. I guess the info I got was wrong