我试图让这个htaccess规则起作用:
RewriteRule ^([^/]*)/$ /?page=$1 [L]
RewriteRule ^([^/]*)/([^/]*)$ /?page=$1&show=edit&id=$2 [L]
首先,我认为这是解决方案,但它打破了我的应用程序。
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /?page=$1&show=$2&date=$3 [L]
有人可以告诉我如何设置它吗?
答案 0 :(得分:1)
您应该避免重写文件和目录:
RewriteEngine On
# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/?$ /?page=$1 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ /?page=$1&show=edit&id=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /?page=$1&show=$2&date=$3 [L,QSA]