I'm running a Joomla 3.3.6 site and I'm using rewrite. I have a subfolder, that doesn't belong to the joomla site.
I want to exclude this folder from the rewrite rule. This folder is also protected by a httaccess-file, but I cannot access it, because I always get a 404 error-page.

This is my htaccess:

## Begin - Joomla! core SEF Section.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI} !^/(subfolder)$

# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
## End - Joomla! core SEF Section.

Do you have any suggestions?

Thanks Barbara

  • Like johanpw said the .htaccess checks if the folder exists. Is the folder password protected? That makes the folder check fail and Joomla show 404 error, if the server has a custom 401 error page defined. Apr 10, 2015 at 10:44

2 Answers 2


Could you put a .htaccess file containing:

RewriteEngine Off

In the folders you want to exclude from being rewritten.


As far as I know you shouldn't have to exclude sub-folders inside your Joomla installation like that. It doesn't matter if the folder is part of Joomla or not.

The line RewriteCond %{REQUEST_FILENAME} !-d in the default .htaccess file checks if the request matches an existing folder. If it does, the URL is not rewritten.

The problem might be something else, but probably related to your .htaccess file. Your question doesn't make it clear if you get a 404 error for all pages (both Joomla and your subfolder), or only when you try to visit the subfolder (e.g. http://example.com/subfolder).

Here's a couple of things you could check:

  1. Comment/uncomment the line # RewriteBase / by adding/removing the initial # (depending on current state). If your Joomla installation is located within a subfolder of your domain (e.g. the url to your site is http://example.com/joomla), then change it to RewriteBase /joomla
  2. Make sure no menu item in Joomla has the same alias as your subfolder. Joomla won't let you create an alias that matches an existing folder, but if you created the folder after creating the menu item there might be a conflict.
  3. Make sure the .htaccess file in your subfolder is valid. If possible, rename it to anything you want and try visiting the subfolder again.
  4. Make sure the Joomla .htaccess file is valid. If possible, rename it and try again, or try with a new .htaccess file from a clean Joomla installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.