Jump to content


Photo

Apache doesn't pick up .htaccess


  • Please log in to reply
6 replies to this topic

#1 stephenk

stephenk
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 09 April 2006 - 05:47 PM

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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 09 April 2006 - 06:07 PM

You need to change the AllowOverride setting to All which is located near line 280 in the httpd.conf file.

The following is what you'll want to look for:
#
# 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

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

#3 stephenk

stephenk
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 09 April 2006 - 06:18 PM

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

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 April 2006 - 09:21 AM

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.

#5 stephenk

stephenk
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 10 April 2006 - 10:49 AM

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

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 April 2006 - 10:59 AM

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:
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
So its just:
#<Files ~ "^\.ht">
#    Order allow,deny
#    Deny from all
#    Satisfy All
#</Files>
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.

#7 stephenk

stephenk
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 10 April 2006 - 12:21 PM

No, I'm trying to use .htaccess in the normal way - for mod_rewrite etc.

I set up the following .htaccess:
RedirectMatch page1\.html page2.html

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users