【发布时间】:2015-06-06 14:15:12
【问题描述】:
我怎样才能将这两者组合在一起;是不是像 ".(html|php)$" - 请提供代码。
请注意,答案应该适用于所有文件扩展名:您对删除每个文件扩展名有何想法?评论所使用的代码 - 因为很难找到。
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP
RewriteRule (.*)\.html$ $1 [R=301]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.html [L]
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
【问题讨论】:
标签: .htaccess mod-rewrite url-rewriting rewrite file-extension