regex - htaccess rewrite and remove .php extension -


So, I'm reading on mod_rewrite because I want to remove the .php extension and show the URL different, so that End user does not see all logic in the URL.

My goal: /foo.php?p=bar looks like: / foo / bar

where foo and There may be times, numeric and characters, I'm working with .php files only, so it does not have to work with .html and the same way. You can use this code in your DOCUMENT_ROOT / .htaccess file RewriteCond% {REQUEST_FILENAME} -f Rewriting Rule ^ - [F] Rewrite% {DOCUMENT_ROOT} / $ 1:

  Rewrite / rewrite convert to revertbase% {REQUEST_FILENAME} -d [OR] Php -f [nc] revised rules ^ ([^ /] +) /? $ $ 1.php [L] Rewrite% {DOCUMENT_ROOT} / $ 1 \ .php -f [NC] Rewrite Rule ^ ([^ /] +) / ([^ /] +) /? $ $ 1.php? P = $ 2 [L]  

Comments