: Apache rewrite returns error 500 I'm trying to figure out what I'm doing wrong with this .htaccess rewrite: Options -Indexes RewriteEngine on RewriteBase /test/site/ RewriteOptions MaxRedirects=10
I'm trying to figure out what I'm doing wrong with this .htaccess rewrite:
Options -Indexes
RewriteEngine on
RewriteBase /test/site/
RewriteOptions MaxRedirects=10
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/site/public/page.php?rel= [NC,L,B]
I have an Front end script that handles all of the requests. In my case I don't need or have index.php/index.html file in my root project (/test/site/). That causes Apache to throw 403 error because of the first line of the code.
The code will work only if you access the links as follows:
localhost/test/site/public/index http://localhost/test/site/public/something/else/index.html
But if you enter
localhost/test/site/public/
It'll throw 403 error.
I'm pretty sure I'm doing something wrong but I can't figure it out.
More posts by @Fox8124981
1 Comments
Sorted by latest first Latest Oldest Best
Well, your RewriteRule does not apply because that path you are trying is a directory. As set up, your .htaccess redirects things that are neither.
You will need an additional rule or a custom 403 page to handle directories. You may also change your condition to files only. In other words, remove the second RewriteCond line. Which you do depends on what you want to happen for a directory path.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.