我需要一个符合这些规则的.htaccess文件:
任何人都可以帮我吗?这是我到目前为止所得到的:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /staging/
RewriteRule ^favicon.ico favicon.ico [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?p=$1 [NC,L]
但它只适用于前两个条件......
谢谢!
答案 0 :(得分:1)
这两条规则适合你:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([a-z0-9-]+)/?$ index.php?p=$1 [NC,QSA,L]
RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/?$ index.php?p=$1&cat=$2 [NC,QSA,L]
答案 1 :(得分:0)
尝试:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /staging/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)(?:/(.*?)/?|)$ index.php?p=$1&cat=$2 [L,QSA]