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.
using htaccess to remove .php file extensions
Moderator: General Moderators
Re: using htaccess to remove .php file extensions
You need to fix your links so they all say /about and not /about.php.
Re: using htaccess to remove .php file extensions
yes I realized that about a half hour before you replied! thanks!
Everything works great now!
Everything works great now!