• Resolved mckinney3

    (@mckinney3)


    I cannot get any redirect techniques to redirect my old html site pages to my new WordPress pages.

    My current .htaccess files looks like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    I have added a line of code after this code that reads:

    redirect 301 /old_page.htm  http://www.example.com/newpage.htm

    Of course my code has my actual site info inserted.
    I cannot get this technique to work.

    For my pages that have blank spaces, I use this format:

    redirect 301 “/oldpage.htm” http://www.example.com/newpage.htm

    This does not work either.

    What is the correct approach?

Viewing 1 replies (of 1 total)
  • Thread Starter mckinney3

    (@mckinney3)

    I never had any luck with any arrangement of a redirect 301 inserted into the .htaccess file running on a GoDAddy Linux shared server.

    However I did have great luck by using Rewrite Rule syntax. I also found that:
    1. The RewriteRule code must come before the WP inserted code
    2. If old url has spaces then this MUST be addressed with a reverse slash (\) before the space. If this not done, the server will be thrown into a tizzy and you will get plenty of Internal Server Errors and that is not a good thing.
    3. The flags must be set properly
    4. I had trouble at first getting the .htaccess file modified. I was trying to do this thru Dreamweaver and the server Permissions did not like this approach. I was successful by using GoDaddy’s file manager editor directly. Also the change was in effect immediately and I did not have to wait until the top of the hour when GD refeshes the .htaccess file.

    Having said that, here is one actual RewriteRule along with the correct pre-code that works and works well. This example works if both the old and new urls reside below the same domain name. For this example, the original url was http://www.site_name/3rd_Level_pages/Contacts.html The new WP “friendly” link is http://www.site_name/studio/contact/

    The R=301 specifies a permanent redirect and Google will permanently update its search engine
    The NC flag specifies that the addy is NOT case sensitive
    The L flag stops the processing which ultimately enables the WP code that follows these additions to be executed.

    # Begin old site rewrites
    RewriteEngine on
    RewriteBase /
    RewriteRule ^3rd_Level_pages/Contacts.html /studio/contact/ [R=301,NC,L]
    # End old site rewrites

    Here is an example with spaces corrected with the (\):

    # Begin old site rewrites
    RewriteEngine on
    RewriteBase /
    RewriteRule ^4th\ Level\ Pages_Gallery/Jones\ Pottery/Jones\ Pottery.html /artisan-galley/artisans/matt-jones/ [R=301,NC,L]
    # End old site rewrites

    This is an example with the 2 rewrites AND the WP installed Code
    # Begin old site rewrites
    RewriteEngine on
    RewriteBase /
    RewriteRule ^3rd_Level_pages/Contacts.html /studio/contact/ [R=301,NC,L]
    RewriteRule ^4th\ Level\ Pages_Gallery/Jones\ Pottery/Jones\ Pottery.html /artisan-galley/artisans/matt-jones/ [R=301,NC,L]
    # End old site rewrites

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Just insert one line of RewriteRule code for each re-direction that you desire. When finished , be sure that the WP code is still intact.

    By the way, I am not a guru on this subject but for those that are interested I can put you in touch with the fellow that is!

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect from html page to WP page’ is closed to new replies.