我有一个url重写的问题,我必须排除一些目录,因为有一些文件作为CSS,图像和其他。但是我必须
RewriteEngine On
RewriteCond %{REQUEST_URI} !configurazione/ [OR]
RewriteCond %{REQUEST_URI} !funzioni/ [OR]
RewriteCond %{REQUEST_URI} !img/ [OR]
RewriteCond %{REQUEST_URI} !imgprodotti/ [OR]
RewriteCond %{REQUEST_URI} !imgslider/ [OR]
RewriteCond %{REQUEST_URI} !js/ [OR]
RewriteCond %{REQUEST_URI} !palma/ [OR]
RewriteCond %{REQUEST_URI} !sezioni/
RewriteRule ^([a-z]+)/([a-z]+)/([a-z]+).html$ index.php?pag=$1&prodotti=$2&prodotto=$3 [L]
RewriteRule ^([a-z]+)/([a-z]+)/ index.php?pag=$1&prodotti=$2 [L]
RewriteRule ^([a-z]+)/ index.php?pag=$1 [L]
答案 0 :(得分:0)
RewriteCond
仅适用于下一个RewriteRule
。请使用THE_REQUEST
:
RewriteCond %{THE_REQUEST} /(funzioni|img|imgprodotti|js|palma|sezioni|configurazione)/
RewriteRule ^ - [L]
RewriteRule ^([a-z]+)/([a-z]+)/([a-z]+).html$ index.php?pag=$1&prodotti=$2&prodotto=$3 [L,QSA]
RewriteRule ^([a-z]+)/([a-z]+)/ index.php?pag=$1&prodotti=$2 [L,QSA]
RewriteRule ^([a-z]+)/ index.php?pag=$1 [L,QSA]