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
    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

Recommended Answers

All 5 Replies

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]

Ok I have one question where is my error page?

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.

Thany you for the help

is it htaccess or .htaccesss

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.