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,724
  • 3
  • 26
  • 37
Gautam Jha
  • 1,405
  • 1
  • 12
  • 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,791
  • 1
  • 20
  • 29