[英].htaccess file with some exceptions
I need a .htaccess file that follows these rules: 我需要一个符合这些规则的.htaccess文件:
Can anyone help me with this? 谁能帮我这个? This is what I got so far: 这是我到目前为止所得到的:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /staging/
RewriteRule ^favicon.ico favicon.ico [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?p=$1 [NC,L]
But it only works for the first 2 conditions... 但它只适用于前两个条件......
Thanks!! 谢谢!!
These 2 rules should work for you: 这两条规则应该适合你:
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]
Try: 尝试:
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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.