Reputation: 217
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!
Upvotes: 14
Views: 37063
Reputation: 6084
I had problems with PhpMyAdmin in a subdirectory of TYPO3.
After long time I found this block in a .htaccess
-file in a directory above causing malfunction of one file of phpmyadmin:
# UTF-8 encoding
AddDefaultCharset utf-8
<IfModule mod_mime.c>
AddCharset utf-8 .atom .css .js .json .manifest .rdf .rss .vtt .webapp .webmanifest .xml
</IfModule>
Reason for this was that there exists a file phpmyadmin.css.php
which is triggered by the rule.
After changing the rule like following PhpMyAdmin is working normally:
# UTF-8 encoding
AddDefaultCharset utf-8
<IfModule mod_mime.c>
AddCharset utf-8 .atom .js .json .manifest .rdf .rss .vtt .webapp .webmanifest .xml
#####
## This block is for the file phpmyadmin.css.php, where the suffix css is not the last one.
## @see https://httpd.apache.org/docs/current/mod/mod_mime.html#multipleext
#####
<FilesMatch "[^.]+\.css$">
AddCharset utf-8 .css
</FilesMatch>
</IfModule>
The condition <FilesMatch "[^.]+\.css$">
is only triggered if the suffix css
is at the end of the filename.
So my case is not about rewriting but about a resembling problem where rewriting seemed being the solution first for me.
Upvotes: 0
Reputation: 2194
You could also put a new .htaccess file in the folder you want to ignore, saying:
RewriteEngine Off
Upvotes: 23
Reputation: 3918
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.
Upvotes: 17