Hey guys, I'm trying to use this code, but it seems as though the rewrite condition is never satisfied and so it doesnt work.
RewriteCond %{REQUEST_URI} ^payment
RewriteRule ^payment - [L]
RewriteCond $1 !^(index\.php|index\.html|assets|payment|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
The first two lines I added just to play around but basically, any directory that isnt in the rewrite cond should be redirected to index.php. I am using a framework which requires this rewrite rule. The problem is I have a folder called payment in my document root which I want excluded from the rewrite rule.
In that folder, I have another htaccess file with the following code:
RewriteOptions Inherit
AuthName "Admin section"
AuthUserFile "/home/studentc/.htpasswds/public_html/assets/scripts/payment/passwd"
AuthType Basic
require valid-user
I need this folder to have basic authentication. When the auth lines are in the htaccess in the subdirectory the site loads, but i get a "page cannot be found" error when i try and access the payment folder (this is from my application not a standard, which means it is still trying to rewrite the URL). When I remove the authentication lines, the file in the payment directory is accessible and I dont get an error. I'm using Apache 2.0.63. If I put anything in the htaccess in the subdirectory, it is ignored indicating that the rewrite condition negating the payment folder is ignored as it never gets to that htacecss file.
Any help would be MUCH appreciated
Cheers,
J