Home  >  Forum  >  PHP
Post New Query

redirect URL from .php to extension less URL using .htaccess


joined on
April 15,2013
Asked on October 30,2013
Hi All,

I need to write my website without php extension. Currently URL ends with .php
So please help me how to meet this requirement using .htaccess.


joined on
March 14,2013
Replied on October 30,2013

Try this

# .php to extension less
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(([^/]+/)*[^.]+)$ $1.php [L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php http://www.example.com/$1 [R=301,L]

joined on
April 15,2013
Replied on October 31,2013

Thanks Arvind.

Its working
joined on
October 10,2013
Replied on October 31,2013

Its working

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us