Haudegen
Haudegen

Reputation: 498

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?

Upvotes: 2

Views: 612

Answers (1)

anubhava
anubhava

Reputation: 785286

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]

Upvotes: 1

Related Questions