Results 1 to 7 of 7
  1. #1

    Question 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!

  2. #2
    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.

  3. #3
    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?

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Oct 2003
    Posts
    200
    The redirect should work with any page in the site. I have done this many times.

  7. #7
    OK, I'll test it out. I guess the info I got was wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •