0

I want to remove .php extension from all url also want to redirect user to the links without file extension, if someone input url with .php.

change this url http://localhost/xyz.com/post-add.php

to this http://localhost/xyz.com/post-add

for all file is that possible with htaccess?

Aung Myo Linn
  • 2,820
  • 3
  • 27
  • 38
Gautam Jha
  • 1,445
  • 1
  • 15
  • 24
  • This question already asked on [Stackoverflow](http://stackoverflow.com/questions/9635524/remove-php-extensions-with-htaccess-without-breaking-directoryindex) – Gaurav Rai Dec 10 '15 at 10:40
  • Please do a search or even a google search before asking a question – RiggsFolly Dec 10 '15 at 10:40
  • i wanted to ask about redirecting users if someone enter `post-add.php` url automatically changes to `post-add` – Gautam Jha Dec 10 '15 at 10:48

1 Answers1

0
  RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
Parth Chavda
  • 1,819
  • 1
  • 23
  • 30