【发布时间】:2016-12-30 17:59:12
【问题描述】:
这个网址如何:
www.domain.com/services.php?hello-world-be-active
可以改写为:
www.domain.com/services/hello-world-be-active
更新:
以下规则不起作用...我正在使用此规则
RewriteCond %{THE_REQUEST} ^GET\ /(.+)\.php [NC]
RewriteRule ^ /%1 [QSA,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ /$1.php
上述规则给出以下结果:
www.domain.com/whatever.php => www.domain.com/whatever (Correct)
www.domain.com/whatever.php?whatever-whatever => www.domain.com/whatever?whatever-whatever (Not Correct because question mark '?' should replace with slash '/')
【问题讨论】:
标签: apache .htaccess url mod-rewrite url-rewriting