...

View Full Version : .htaccess : Hiding .php extensions in URL



phantom007
07-17-2011, 06:10 AM
Hi

I was wondering if there is anyway we can hide the .php extension in the URL using .htaccess?

For example

These URLs:

http://example.com/home.php
http://example.com/welcome/contact-us.php
http://example.com/home/support/email_us.php


Should look like

http://example.com/home
http://example.com/welcome/contact-us
http://example.com/home/support/email_us


Pls let me know if this is possible and how?


Many thanks

dhape
09-21-2011, 01:20 AM
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


With this rewrite, http://www.example.com/home.php is the same as http://www.example.com/home

phantom007
09-21-2011, 04:02 AM
Thanks very much

Jinxy
09-23-2011, 02:08 AM
This should do it for all extensions:


Options +MultiViews

developersend
09-17-2014, 10:18 PM
Your code is copy my htaccess file but don't working.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

This above code is not working.
Pls help me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum