Viewing 4 replies - 1 through 4 (of 4 total)
  • The redirect from www to non-www should be added to your .htaccess file or better yet: add it to your DNS settings.

    The actual page url redirects you can add to the redirection plugin.

    Thread Starter rtc

    (@rcyrus)

    JRF,
    Thanks so much for the reply. I have canonical tags enabled in wordpress now so wouldn’t it know to correct for the www vs. non-www? Also, my wordpress site won’t let me create .html pages at all, which I assume would not be needed to get this fixed.

    If not, how do I add this instruction to the .htaccess file? I am not sure how to do this.

    Currently, in the .htaccess file I have inserted the code below to send all urls with .html to the home page, but this is causing other problems in wordpress so I have to change that to the new code. Thanks!

    RewriteEngine on
    RewriteCond %{REQUEST_URI} .*\.html
    RewriteRule ^(.*)/ / [R]

    I have canonical tags enabled in wordpress now so wouldn’t it know to correct for the www vs. non-www?

    No, that’s outside of WordPress, www is a subdomain and needs to be redirected at a server level to the non-www. (or visa versa) However most web host do this automatically. Check with yours.

    Also, my wordpress site won’t let me create .html pages at all, which I assume would not be needed to get this fixed.

    Correct, it’s better to redirect to the new pages rather than re-create the old pagename.

    Currently, in the .htaccess file I have inserted the code below to send all urls with .html to the home page, but this is causing other problems in wordpress so I have to change that to the new code. Thanks!

    RewriteEngine on
    RewriteCond %{REQUEST_URI} .*\.html
    RewriteRule ^(.*)/ / [R]

    A simpler way to do this would be to add something along the lines of the below to .htaccess. Make sure you add this *above* the RewriteEngine on line.

    RedirectMatch permanent ^/.+\.html$ http://yourwebsite.com/

    Best way of course would be to have a pattern which redirects to the correct new page.
    So say you have old page names of the form:
    oldpage.html, anotheroldpage.html
    And you create the pages in WP with the same bit before the .html as the slug, so oldpage, anotheroldpage.

    Then you could just do the below to redirect to the new page:
    RedirectMatch permanent ^/(.+)\.html$ http://yourwebsite.com/$1

    Hope this helps.

    Thread Starter rtc

    (@rcyrus)

    JRF,
    Thanks so much for your patience! This is very helpful! Just a couple of clarification points for this novice . . .

    In both of the solutions above, I see that “.html” is still being referenced. In my added code, “.html” is referenced as well. The problem is that the pages now redirect to the home page (which while not ideal, would be okay), but the “.html” reference is grabbing all “.html” pages including the “.html” wordpress media urls which are used when I try to edit a photo in wordpress. When I click on the edit button on the photo it sends me to the home page, instead of the edit page with advanced settings. Which of your solutions would be best to prevent this from happening? (I am guessing the second one?) Also, for the second solution, if that is best, do I completely remove the code that I added and just use this instead? Would I just copy it in the same place as the existing code? Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Old Site Redirect’ is closed to new replies.