0

Hy
I have a problem with my apache in wamp it dosen't recognize my htaccess file and I have searched everywhare to find a solution to the problem.
Fot starters I want just to show my 404 custom page but my code is not working.

`<Files ~ "^\.(htaccess|htpasswd)$">
    deny from all
    </Files>
    Options Indexes
    ErrorDocument 404 404.html
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.localhost/magiclight)(:80)? [NC]
    RewriteRule ^(.*) http://localhost/magiclight/$1 [R=301,L]
    DirectoryIndex index.php       
    order deny,allow`

This is all my code can anyone show me who to make this work and even give usefull advice for the future because I like good security and flexebility in my apps.

Thank you

3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by almostbob
0

Have you got the Apache rewrite module active?

Try this

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.localhost/magiclight)(:80)? [NC]
RewriteRule ^(.*) http://localhost/magiclight/$1 [R=301,L]
</IfModule>
0

Sorry, you can add to what I posted of course, I was just highlighting the check for your rewrite rules.

Someone correct me if I'm wrong, but I don't think the Error page or access rules need to be inside the IfModule block. It's been a while since I wrote .htaccess rules by hand.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.