.htaccess file not being read on localhost

9,501

Solution 1

Try add

AllowOverride All

inside tag.

Solution 2

Praise the lord and pass the ammunition.

This post pointed me to the answer, and the people were led out of the desert: https://stackoverflow.com/questions/1608589/how-to-enable-htaccess-in-httpd-conf-on-xp

My file was saved as "htaccess" not ".htaccess". The first time I saved the file, I certainly added the dot, but Windows dropped it when saving the filename. Just now I opened it with Notepadd++ and renamed it ".htaccess" and violá!

Man, this should not be this difficult...

Share:
9,501

Related videos on Youtube

Bryan
Author by

Bryan

Updated on September 17, 2022

Comments

  • Bryan
    Bryan almost 2 years

    My live site reads the .htaccess fine. I got 404.php and mod_rewrite working fine there, but on my localhost... nothing.

    • PHPmyAdmin 3.1.5
    • PHP 5.2.9-2
    • Apache 2.2

    My .htaccess is this:

    ErrorDocument 404 /404.php
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^news/([0-9]+)-(.*)\.html$ news/index.php?id=$1 [L]
    

    Reading http://localhost/phpinfo.php reveals that mod_rewrite is turned on, but it doesn't work, neither does the 404.php page. The Apache error logs only reveal that the page was not found on this server.

    My httpd.conf currently looks like this:

    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    
    <Directory />
        Options FollowSymLinks
        Order Allow,Deny
        Allow from 127.0.0.1
        Deny from All
    </Directory>
    

    I can change it to any combination you want, but it won't do anything. Where else could the source of my headaches be? What am I missing?

    Thanks, signed, noob (at technical stuff)

  • David Parvin
    David Parvin over 14 years
    Tried it, restarted Apache Server. Still nothing. The problem is likely somewhere in how my local server is reading the page, not so much the allow,deny. I've tried every combination of that.
  • Jeremy L
    Jeremy L over 14 years
    It should be inside the Directory tag for your DocumentRoot, which I believe you didn't post here.