【问题标题】:.htacces url rewrite exclude some directory.htaccess url 重写排除某些目录
【发布时间】:2014-10-29 20:19:33
【问题描述】:

我的 url 重写有问题,我必须排除一些目录,其中有一些文件作为 css、图像和其他。但是我不得不

重写引擎开启

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]

【问题讨论】:

  • 欢迎来到 StackOverflow!你可以说得更详细点吗?目前尚不清楚问题是什么,或者您需要从您所写的内容中获得什么帮助。

标签: .htaccess url rewrite


【解决方案1】:

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]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-09
    • 1970-01-01
    • 1970-01-01
    • 2018-03-28
    相关资源
    最近更新 更多