【发布时间】:2017-11-18 16:25:40
【问题描述】:
我已经有适用于 html 的无扩展名 url,但该网站多年前曾经有 php 和 aspx 文件,这些文件也显示为 404。有人可以告诉我在哪里添加 php 和 aspx 到以下内容:
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.+)\.html$ http://example.com/$1 [R=301,L]
【问题讨论】:
-
原来的网址是:
http://example.com/about.php,而新的网址是http://example.com/about?要删除 php 和 aspx 扩展,您可以将正则表达式更改为:^(.+)\.(html|php|aspx)$.