Hey,
I'm trying to set up mod_rewrite for my site and have a few questions.
I have rewritten URLs so that they are easy to read and understand. I would like to have a rule that would redirect someone trying to directly access php scripts to an error page. For example, going to www.domain.com/blog/ will show blog.php, but when the user tries to go to www.domain.com/blog.php, they will be sent to www.domain.com/error/.
RewriteCond %{REQUEST_URI} .php
RewriteRule ^$ /error/ [R=301]
It doesn't work, and doesn't seem right. Any idea how this can work?
Also, I have a folder with all of my scripts that are accessed with AJAX. Is there a way to prevent access to these scripts directly as well? Maybe something like redirecting to /error/ if the request is not an XMLHTTPRequest, or is this more of a mod_access thing? I'm not familiar with mod_access though, and would appreciate any help you can give with that as well.
Thanks for your time and your help!