mod rewrite - How to delete .php extension from URL? -


How do I delete the .php extension from URL with mod_rewrite?

For example:

test.com/index.php - & gt; Test.com/index/ test.com/contact.php - & gt; Test.com/contact/

rewinding sign on rewrite ^ ([^ / ] +) /? $ $ 1.php

If the user is typed in http://example.com/index/ , then they http: // example Actually, this rule says "everything matches a base slot up to a slash, or if there is no slash, but it is not included in the slash. Then give to the user who connects with .php at the end. "

This is going to work only for the first level of the directory; To wit. It will not match on example.com/index/some/other/stuff - There are no redirects.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -