我制作了所有的 htaccess 重写器,但现在我想从中排除所有目录和文件。欢迎所有有关此 htaccess 的提示,因为我没有重写规则的经验...
我发现 RewriteCond 仅适用于随后的第一条规则。因此,如何从所有规则中排除所有文件和目录?
Allow from All
RewriteEngine on
SetEnv DEVELOPMENT_ENVIRONMENT true
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#One url parameter
RewriteRule ^([a-zA-Z0-9_]*)/$ index.php?language=$1
RewriteRule ^([a-zA-Z0-9_]*)$ index.php?language=$1
#Two url parameters
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)$ index.php?language=$1&page=$2
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/$ index.php?language=$1&page=$2
#Three url parameters
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)$ index.php?language=$1&page=$2&feed=$3&message=$3&page_number=$3&id=$3
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/$ index.php?language=$1&page=$2&feed=$3&message=$3&page_number=$3&id=$3
#Four url parameters
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_\-]*)$ index.php?language=$1&page=$2&id=$3
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_\-]*)/$ index.php?language=$1&page=$2&id=$3
#Five url parameters
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)$ index.php?language=$1&page=$2&feed=$3&year=$4&month=$5
RewriteRule ^([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*)/$ index.php?language=$1&page=$2&feed=$3&year=$4&month=$5