using htaccess to remove .php file extensions
Posted: Fri Jan 22, 2016 8:35 pm
Hi everyone.
I'm trying to remove .php extensions from all my .php files using .htaccess. It is partially working.
what i am using is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
What I need it to do is remove the .php extension when the page is visited, like so:
http://mysite.com/about.php
http://mysite.com/about
*mysite.com is a domain name just used as an example
I can go directly to http://mysite.com/about and the page loads, properly, but if i navigate from within the site to the about page, the url returns to http://mysite.com/about.php.
I've tried many different ways to write the rewrite statement, but it doesn't remove the .php extension when navigating to that menu from within the site.
Any ideas why this might be happening?
*since posting, I resolved my issues
Thanks.
I'm trying to remove .php extensions from all my .php files using .htaccess. It is partially working.
what i am using is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
What I need it to do is remove the .php extension when the page is visited, like so:
http://mysite.com/about.php
http://mysite.com/about
*mysite.com is a domain name just used as an example
I can go directly to http://mysite.com/about and the page loads, properly, but if i navigate from within the site to the about page, the url returns to http://mysite.com/about.php.
I've tried many different ways to write the rewrite statement, but it doesn't remove the .php extension when navigating to that menu from within the site.
Any ideas why this might be happening?
*since posting, I resolved my issues
Thanks.