louis_coetzee Posted April 3, 2009 Share Posted April 3, 2009 I want to deny access to all files on server except for the index.php file which acts as a container for all the other pages it loads into it. I want to prevent someone from accessing for instance login.php >> rather index.php?id=login Thanks Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 RewriteEngine On RewriteRule (.*) index.php That should do it. Quote Link to comment Share on other sites More sharing options...
louis_coetzee Posted April 3, 2009 Author Share Posted April 3, 2009 This is what happens: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 OK maybe not as it seems! RewriteEngine On RewriteRule .(php|html)$ index.php See if that works. Quote Link to comment Share on other sites More sharing options...
louis_coetzee Posted April 3, 2009 Author Share Posted April 3, 2009 OK maybe not as it seems! RewriteEngine On RewriteRule .(php|html)$ index.php See if that works. Aint working, same error! Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2009 Share Posted April 3, 2009 You need to enable the mod rewrite module in your httpd.conf first. Stop and start your web server to get any changed made to httpd.conf to take effect. Quote Link to comment Share on other sites More sharing options...
ranjuvs Posted April 3, 2009 Share Posted April 3, 2009 Try this one <IfModule mod_rewrite.c> RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php </IfModule> Regards Ranju Quote Link to comment Share on other sites More sharing options...
louis_coetzee Posted April 3, 2009 Author Share Posted April 3, 2009 Thanks, now it's working, had to enable mod_rewrite in php.ini Quote Link to comment Share on other sites More sharing options...
louis_coetzee Posted April 3, 2009 Author Share Posted April 3, 2009 if I have done all of this, how can I now where the person types in kaas.php for example and the server assumes it is index.php change it back to index.php or /indexdir that is index.php Quote Link to comment Share on other sites More sharing options...
louis_coetzee Posted April 3, 2009 Author Share Posted April 3, 2009 Try this one <IfModule mod_rewrite.c> RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php </IfModule> Regards Ranju if I have done all of this, how can I now where the person types in kaas.php for example and the server assumes it is index.php change it back to index.php or /indexdir that is index.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.