htaccess重写.htm到html无法正常工作 [英] htaccess rewrite .htm to html not working
问题描述
在我的网站的.htaccess文件中,我添加了以下规则来重写.html扩展名为.html的所有请求:
RewriteRule ^(。*)\.htm $ $ 1.html [NC]
大部分网址在我的网站上被正确地重写,但不是以下URL。我不知道为什么这个URL没有被重写规则捕获:
http://www.mydomain.com/查看/ 186/4-test-limited.htm
任何帮助都将不胜感激
您需要先激活mod_rewrite。
尝试:
$ b
RewriteEngine on
RewriteBase /
RewriteRule ^(。*)\.htm $ $ 1.html [R = permanent]
$ b $
R =永久
标志告诉Apache发出一个永久重定向301响应,这对搜索引擎非常友好。
此外,还有很多在线资源: b : In my website's .htaccess file I added the following rule to rewrite all requests with .htm extension to .html: 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: Any help will be much appreciated You need to activate the mod_rewrite first. Try: The Also, there are these great resources available online: Also worth checking: 这篇关于htaccess重写.htm到html无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ b
RewriteRule ^(.*)\.htm$ $1.html [NC]
http://www.mydomain.com/view/186/4-test-limited.htm
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.htm$ $1.html [R=permanent]
R=permanent
flag tells Apache to issue a permanent redirect 301 response, which is search-engine friendly.