0

My site URL is http://funandfoodcafe.com I changed my Permalink structure to Postname today, and I am using WP 3.5.

All the links on the site redirect to the new structure correctly, but all incoming links, from Google or any other referring sites still go to "http://funandfoodcafe.com/post-name.html" instead of "http://funandfoodcafe.com/post-name/"

The extra .html is causing all incoming links to result in 404 errors. I get heavy referral traffic, so this is really bad, because its almost like my site is down!

Can someone help me resolve this issue please?

Thanks, Mansi

3

1 Answer 1

1

In your .htaccess file put:

RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*).html$ /$1/ [R=301,L]

That should redirect with a "moved permaently" from the .html pages to pages with the endings stripped. It should probably go above your WordPress rules. It should even preserve query strings-- at least it did when I tested it.

1
  • Aah! thanks so much ha_dum, that worked. I needed to add another redirect statement to my .htaccess too, for some other links that were not being redirected by using WP alone, so I added these 3 lines to my .htaccess file: "RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ funandfoodcafe.com/$3 RewriteCond %{REQUEST_URI} \.html$ RewriteRule (.*).html$ /$1/ [R=301,L]" and looks liek its working for now...will test some more and let you know how it goes!
    – Mansi
    Commented Jan 24, 2013 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.