I am using an .htaccess file to hide the .php extensions in URLs. Although it is working fine, I now have to also hide the .php file extension in all the links that are shown on the page.
For example, when I hover the mouse over the link, its URL is showing the status bar and includes the .php extension. How can I remove the .php from the link URLs too or completely hide the URL in the status bar of the browser?
I'm using the following code in my .htaccess file:
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / ## don't touch /forum URIs RewriteRule ^forums/ - [L,NC] ## hide .php extension snippet # To externally redirect /dir/foo.php to /dir/foo RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L] # To internally forward /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [L] # To remove www header RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [L,R=301] (Code originally based on this answer by anubhava.)
The links in my HTML file look like menu1.php, menu2.php, etc. When I click on these links the URL shown in the browser URL bar looks like domain.com/menu1, which is good. But in the status bar, when I hover over these links, it still shows menu1.php.
How can I hide that .php suffix in the status bar? Do I have to manually change all the URLs in all the links, or there is some way I can hide them?