SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 28 of 28
  1. #26
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,657
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ServerStorm View Post
    Hi Eric,

    I'll make it clear that although I've been pouring many hours recently into learning mod-rewrite specifics, I am not an expert, but what I'm talking about may very well work for you.

    So to be clear, the ErrorDocument 404 /404.php line is put in an .htaccess file inside the root of your new server. It goes prior to the RewriteEngine on like:
    Code:
    # This handler tells Apache to point any page request that come in to
    # redirect a page not found (404 error) to a custom 404.php page
    # It is a very good idea to put both a simple 404 message and a map of the
    # New site structure so people can navigate to the main site directly.
    
    ErrorDocument 404 /404.php
    RewriteEngine on
    
    # ... more rewrite code goes here
    So to do your rewriting from your old server to the new server's sub-directory you use a 301 - permanent redirect. Using 301s is the current recommended practise of redirecting domains. Search engine bots run through a 301 and will in time index as a permanent change. Meanwhile the SEO juice you've have will somewhat be retained. I mean somewhat as it seems that Google will honour most of your 301 redirects and your SERPs don't fall. Yahoo is not quite as good and Bing may not honour them at all. However they will help moreso than doing nothing.

    So on your new server in the root folder, create a .htaccess file, and put something like this:
    Code:
    RewriteEngine on
    RewriteRule ^([a-z\.]+)$ http://new_server.com/subfolder/$1 [R=301]
    With this if you click a link in a search that has <a href='http://old_server.com/puddles.html'>A number of pictures of puddles</a> then the user will be redirected to http://new_server/subfolder/puddles.html. As this is a generic match http://old_server.com/puddles.php or http://old_server.com/puddles.aspx will be redirected to http://new_server.com/subfolder/puddles.php and http://new_server.com/subfolder/puddles.aspx.

    With this all your web files will redirect to the new server and they will look for the same file names and extensions as on the old server.

    DK may be able to chime in here and give you a far superior way. I do know that the approach I recommend is not greedy or taxing on your old server.

    Regards,
    Steve
    Thank you. But if I have 17 different subfolders that would not work right?

  2. #27
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by EricWatson View Post
    Thank you. But if I have 17 different subfolders that would not work right?
    Yes you're correct. You may either look at reorganizing your file structure, if this is too enormous of an undertaking then you may have to not use a generic .htaccess and use a rewrite map. But with lots of links this could be a lot of work for you and for your web-server. It really depends on if you want to retain the SERPs as they take time to build-up.
    ictus==""

  3. #28
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Another question about RewriteMap. Please view the other current thread about 1000+ redirections for a discussion of your options.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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