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


PHP


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.





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]





Replied on October 31, 2013
Thanks Arvind.

Its working



Replied on October 31, 2013
Its working

Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us