Jump to content

Archived

This topic is now archived and is closed to further replies.

stephenk

Apache doesn't pick up .htaccess

Recommended Posts

When I place the a simple .htaccess file in my root, apache doesn't seem to pick it up at all. I have
"AccessFileName .htaccess" in httpd.conf and was just wondering if there are any obvious points I'm missing?

Thanks for any help
Stephen

Share this post


Link to post
Share on other sites
You need to change the [b]AllowOverride[/b] setting to [b]All[/b] which is located near line 280 in the httpd.conf file.

The following is what you'll want to look for:
[code]#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride[/code]

Now save your httpd.conf file and restart Apache. You should beable to use .htaccess files.

Share this post


Link to post
Share on other sites
Thanks for your reply - but that is already set in my httpd.conf file.
My httpd.conf is the WAMP version, would that have changed any major settings needed for .htaccess to work?

Stephen

Share this post


Link to post
Share on other sites
Did you restart Apache? after making the changes and made sure there wasn't any #'s in front of the lines you edited if ther is then remove the # as these are comments and so APache ignore these lines.

Now save the httpd.conf file and restart Apache. Also make sure your .htaccess folder in the root of the folder thgat stores your files to be seen by the webserver.

Share this post


Link to post
Share on other sites
Yeah, I did restart Apache with changes, and the lines aren't commented out.

Ive uploaded my httpd.conf at [a href=\"http://www.stephenknox.com/httpd.conf\" target=\"_blank\"]http://www.stephenknox.com/httpd.conf[/a] if someone would be so kind as to look at it!

Other than that, I'm completely stuck with this problem.

Thanks
Stephen

Share this post


Link to post
Share on other sites
Are you trying to view your .htaccess file when you go to [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] and then from the list of files find your .htaccess file?

If so then Apache hides these files. If you want it to be viewable then commnent out the following:
[code]<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>[/code]So its just:
[code]#<Files ~ "^\.ht">
#    Order allow,deny
#    Deny from all
#    Satisfy All
#</Files>[/code]
Now save and restart Apache. You should be able to see your .htaccess file listed with all your other files.

Even though yoiur .htaccess file is not viewable APache will still use the .htaccess file it just hides it from users for security purposes as it can contain private information which you may not want your visitors to see.

Share this post


Link to post
Share on other sites
No, I'm trying to use .htaccess in the normal way - for mod_rewrite etc.

I set up the following .htaccess:
[code]RedirectMatch page1\.html page2.html[/code]

but when I go to localhost/test/page1.html (the .htaccess is placed in /test), it doesnt redirect to page2

Thanks for your answers so far,
Stephen

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.