• I have been upgrading several old static websites lately to WordPress. In order to transfer the pagerank in Google over to the new website, you need to create permanent redirects for each of the old .html pages in the .htaccess file.

    After searching numerous websites for info on how to do this, I finally got this to work. Here is what your .htaccess file should look like after you have added in your permanent re-directs. You will need one re-diect for each old page.Each re-direct should be on one line only, not two, with a single space between the old page name and new location. Make sure you pay attention to the forward slashes: one before the old page name, and none at the end of the new page location.

    *Note: Remove the [] from the location of the new page shown below.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    Redirect permanent /old_page.htm [https://www.yoursite.com/new_page]
    Redirect permanent /old_page2.htm [https://www.yoursite.com/new_page2]
    </IfModule>

    # END WordPress

Viewing 3 replies - 1 through 3 (of 3 total)
  • there’s actually an easier way to do this, just create WP “pages” named the same thing as the old pages but without the .html extension (old_page instead of old_page.html for example), then just create one re-write rule to append the .html to the address (you could also do this with posts/category structure and custom permalinks which end with .html, see the codex permalinks section for more details on this) we’ve used both methods, and both work pretty much the same, something like old_page.html becomes either a WP post called old_page or a WP page called old_page, then by adding the .html either through permalinks or .htaccess you retain the old pagerank since to google, etc, the same page is available via the old URI.

    this is a much better strategy than redirecting to new URI’s which can have mixed results when it comes to page rank.

    …c

    Thread Starter ecographic

    (@ecographic)

    You must also disable wp-cache while you add permanent redirects to the .htaccess file, or it will just revert back to the .htaccess file without the redirects once the cache expires

    Thread Starter ecographic

    (@ecographic)

    You also need to add this line before your permanent redirects:

    # redirect a page or directory

    so your .htaccess file would read:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # redirect a page or directory
    Redirect permanent /old_page.htm [https://www.yoursite.com/new_page]
    Redirect permanent /old_page2.htm [https://www.yoursite.com/new_page2]
    </IfModule>

    # END WordPress

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress 2.0: Adding Permanent Re-direct to .htaccess’ is closed to new replies.