In my website's .htaccess file I added the following rule to rewrite all requests with .htm extension to .html:
RewriteRule ^(.*)\.htm$ $1.html [NC]
Most of the URLs in my website were rewritten correctly but not the following URL. I don't know why this URL is not caught by the rewrite rule:
http://www.mydomain.com/view/186/4-test-limited.htm
Any help will be much appreciated
You need to activate the mod_rewrite first.
Try:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.htm$ $1.html [R=permanent]
The R=permanent
flag tells Apache to issue a permanent redirect 301 response, which is search-engine friendly.
Also, there are these great resources available online:
Also worth checking:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.