Page is a not externally linkable
Zuulo - 12:50 pm on Oct 12, 2012 (gmt 0)
Hello,
I hope you can help me with a little mod_rewrite issue. I have index.php and foo.php in my document root, but I need this behaviour:
example.com # 200
example.com/foo # 200
example.com/foo.php # 404
So it should not be possible to call the .php file directly.
I tried something like this, but now example.com/foo also responses with a 404.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1\.php [L]
RewriteCond %{REQUEST_URI} \.php$
RewriteRule ^(.*)$ - [L,R=404]
Can you help me?
Greetings,
Zuulo