Link Duplicity problem with .htaccess and mod_rewrite

adamseel

New Member
Sorry I couldn't come up with a better title.Here is my htaccess\[code\]RewriteEngine onRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule ^(.*)$ $1.php [L,QSA]\[/code\]And this is my problem: localhost/validpage gives me the contents of localhost/validpage.php.localhost/validpage/blah also gives me the same (validpage.php) page and so does localhost/validpage/blah/blah/...Therefore the problem I am facing is link duplicity(in my words!).How do I allow \[code\]localhost/validpage.php\[/code\] to be accessed from \[code\]localhost/validpage\[/code\] only and nothing else, not even \[code\]localhost/validpage.php\[/code\].I have started a question on ServerFault too but with not much success.The answer I have got is it cannot be done with htaccess alone.By validpage I mean any valid page on the server. Since I am retrofitting an existing site with mod_rewrite for cleaner urls, I am looking for a relatively easy solution preferably with .htaccess only. However, any solutions are welcome.
 
Back
Top