Results 1 to 4 of 4

Thread: Mod_rewrite rule not working

  1. #1
    Join Date
    Apr 2008

    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.

  2. #2
    Join Date
    Jun 2009
    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

  3. #3
    Join Date
    Apr 2008
    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?


  4. #4
    Join Date
    Jun 2009
    Kindly try to add below line in your .htaccess and have a try:

    DirectoryIndex index.html index.htm index.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center