I’ve just changed permalinks in my wordpress site.
And my old links were like that,
http://www.sitename.com/category/postname.html
Now new links are
http://www.sitename.com/category/postname/
I’m getting 404 error at old links, how can i redirect all .html pages to new non .html pages with .htaccess?
In the htaccess file in your document root, add these before your wordpress rules:
Of if you need to limit it by hosts, you can use mod_rewrite:
In the htaccess file, just put:
The accepted answer (above) from
Jon Lin
caused some issues for me.This is my result, which works well, and is a bit more compact.
It works for both, with and without directories in the path.
Oneliner:
Or if you need it limited by host:
Example: