简体   繁体   中英

URL rewrite - make exception

My url-rewrites works perfectly after receiving some help here. However, I can't access my admin2-folder. I got the following code in my .htaccess file: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /test-site/

RewriteCond %{REQUEST_URI} !^/admin2/?$ [NC]

RewriteRule ^([^/]+)/([a-z]+)/(\d+)/?$ index.php?site=$1&cmd=$2&id=$3 [L,NC,QSA]
RewriteRule ^([^/]+)/([a-z]+)/?$ index.php?site=$1&cmd=$2 [L,NC,QSA]
RewriteRule ^([^/]+)/(\d+)/?$ index.php?site=$1&id=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?site=$1 [L,QSA]

When trying to access localhost/test-site/admin2, it just redirects me to localhost/test-site/admin2/?site=admin2. How can I solve this?

Thanks in advance.

This solved my problem:

RewriteRule ^admin2($|/) - [L]

RewriteRule ^([^/]+)/([a-z]+)/(\d+)/?$ index.php?site=$1&cmd=$2&id=$3 [L,NC,QSA]
RewriteRule ^([^/]+)/([a-z]+)/?$ index.php?site=$1&cmd=$2 [L,NC,QSA]
RewriteRule ^([^/]+)/(\d+)/?$ index.php?site=$1&id=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?site=$1 [L,QSA]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM