Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude folder from htaccess

Tags:

.htaccess

I have a site which uses htaccess in order to use nice URLs. However I want the htaccess file to leave alone a whole folder and it's content completely. The content of my htaccess file is:

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

How should I complete the above code to EXCLUDE completely the folder named "admin"

Many thanks in advance!

like image 392
user1185551 Avatar asked Dec 12 '12 10:12

user1185551


People also ask

What is RewriteBase?

RewriteBase is a useful server directive available for Apache web server that allows you to easily update numerous rewrite rules at one go.


2 Answers

You could also put a new .htaccess file in the folder you want to ignore, saying:

RewriteEngine Off
like image 165
Albert-Jan Verhees Avatar answered Jan 02 '23 22:01

Albert-Jan Verhees


Where the folder you want excluded is /excluded-folder/ you would add the following rule:

RewriteCond %{REQUEST_URI} !^/excluded-folder/.*$

before the other two RewriteConds you have listed.

like image 35
Wige Avatar answered Jan 02 '23 22:01

Wige