开发者

What is wrong with my rewrite rule to exclude directory?

开发者 https://www.devze.com 2023-03-22 23:52 出处:网络
Root directory like this: /index.php /App /Extend /PHPrpc ... I want exclude sub directory /Extend and /Phprpc from the rules.

Root directory like this:

/index.php
/App
/Extend
/PHPrpc
...

I want exclude sub directory /Extend and /Phprpc from the rules.

The old .htaccess file like this:

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
开发者_运维技巧

The following is modified by me:

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(Extend|PHPrpc) - [L]  #exclude directory
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

But I get 500 Internal Server Error.

Any advise?


If you want to exclude the URLs, simply filter it using RewriteCond:

RewriteCond %{REQUEST_URI} !^/(Extend|Phprpc)/

0

精彩评论

暂无评论...
验证码 换一张
取 消