【发布时间】:2016-03-04 12:00:12
【问题描述】:
我将如何改变
http://example.com/?sort=top&time=variable
到
http://example.com/top/variable
&time=variable 可能并不总是被使用。
我当前的 htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?showcase/(.*?)/?$ /showcase.php?id=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /showcase\.php\?id=([^\&\ ]+)
RewriteRule ^/?showcase\.php$ /showcase/%1? [L,R=301]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
将http://example.com/showcase.php?id=int 重写为http://example.com/showcase/int。
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting friendly-url