简体   繁体   中英

no rewrite on specific folder - htaccess

My current .htaccess -File looks like this:

RewriteEngine On
RewriteBase /folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^/]+)/?$ index.php?g=$1 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?g=$1&pt=$2 [L,QSA]

There is the physical folder install.

If I try to open http://example.com/install instead of opening the install/index.php it tries to open index.php?g=install . No wonder here, because, thats what I wanted. But how can I still open the install -Folder. Everything go to index, but install go to install ...

I tried something like this: RewriteRule ^install/index\\.php$ /install/index.php [R=301,L,NC]

Still not working.

Any Ideas?

Create a bypass rule for /install/ URI:

RewriteEngine On
RewriteBase /folder/

# skip /install/ from rules below
RewriteRule ^install/?$ - [L,NC]

# skip all directories and files from rewrites
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# handle single level virtual folder 
RewriteRule ^([^/]+)/?$ index.php?g=$1 [L,QSA]

# handle 2 level virtual folders 
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?g=$1&pt=$2 [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