Mod_rewrite: How to catch .php files?

evilrenan

New Member
I'm trying to catch all .php requests so that my visitors won't be able to see the php magicI want \[code\]example.com/home\[/code\] to be redirected to \[code\]example.com/index.php\[/code\], but I don't want direct access to \[code\]example.com/index.php\[/code\]\[quote\]\[code\]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$1 [L]\[/code\]\[/quote\]Although it seems to work at first glance, it doesn't prevent users from visiting example.com/index.php directly.How would I solve this?In reply to an answer:\[code\]RewriteRule ^index.php$ / [R=301,L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$1 [L]RewriteRule ^home/?$ /index.php?category=1 [L]\[/code\]\[code\]example.com/home\[/code\] outputs \[code\]example.com/category=1\[/code\]
 
Back
Top