Jump to content

htaccess check if url filename exists in certain folder


JamesB

Recommended Posts

Hi! Is it possible to have a htaccess file check if the filename in the URL, exists in a certain folder on the server? I have this URL:http://127.0.0.1/mywebsite/directions Which should check if this file exists:<root>/mywebsite/Templates/Pages/directions.php If it doesn't exist, a 404 should be given. I have this code:

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond /Templates/Pages/%{REQUEST_FILENAME}.php !-fRewriteRule (.*) - [L,R=404] </IfModule>

But it's currently giving a 404 on all pages. Edit:The .htaccess file is at:<root>/mywebsite/.htaccess

Edited by JamesB
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...