Mod_rewrite rule not working
Here is what I trying to do:
I want any http request to a particular directory to run a static PHP script. The static PHP script does not reside in the Document_Root, but another directory on the server.
Here is the RewriteRule in my .htacess file in directory 'test':
RewriteRule ^(.+)$ /phpDir/myScript.php [L]
The 'test' directory is empty except for the .htaccess file.
I get 2 different results from my browser:
http://sampleDomain.com/test/ = 403 Forbidden Error
http://sampleDomain.com/test/index.html = 404 Page Not Found
(I do have "Options -Indexes" in my httpd.conf file)
Thanks for the troubleshooting help.
You will have to check the apache error logs for the exact error message as there are many reasons regarding the 403 and 404 error message. You will find the apache error logs at /usr/local/apache/logs/error_logs
Thanks "thewebhostindi". That helped.
Now the only trouble I have is the following:
Here is my directive:
- RewriteRule ^(.+)$ /phpDir/myScript.php [L]
What does the RewriteRule look like to get everything/anything to evoke myScript.php?
Kindly try to add below line in your .htaccess and have a try:
DirectoryIndex index.html index.htm index.php
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)