.htaccess - Mod_rewrite: How to catch .php files? -


I am trying to capture all .php requests so that my visitors can see PHP. Magic

I have to redirect example.com/home to example.com/index.php , but I do not want to < Regardless of access to Code> example.com/index.php

  RewriteCond% {REQUEST_FILENAME}! -f Rewrite Convert% {REQUEST_FILENAME}! -d RectitRule ^ (. *) $ Index.php / $ 1 [L]  

Although it seems to work at first glance, Will not stop going to .com /index.php directly.

How do I solve it?


In response to an answer:

  rewrite rule ^ index.php $ / [R = 301, L] rewrite% {REQUEST_FILENAME} ! -f rewrite code% {REQUEST_FILENAME}! -d Recruitment Rule ^ (. *) $ Index.php / $ 1 [L] Rewrite Rule ^ / home? $ / IndexFP? Category = 1 [L]  

For example output example.com/category=1 < / P>

Try this:

  rewrite ^ ^ index.php $ / [ R = 301, L] rewrite% {REQUEST_FILENAME}! -f rewrite code% {REQUEST_FILENAME}! -D Rivetrium ^ (. *) $ Index.php? / $ 1 [L]  

What will happen if the user tries to go straight to index.php, then it redirects on the root of the site is . Otherwise, it will run your current rule, anything will pass from the index. PHP.


Comments