There are times that you don’t want to give visitors a clue what the programming language you are using. This can be easily achieved. Take a look at the code below:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]
In this example, this will completely remove the file extension from your URL such as example instead of example.php











































#1 by Muro on December 24, 2008 - 10:38 am
Very Usefull İnfo. I used this feaure on this site http://property.theartofbronzeland.com
#2 by Dennis on January 31, 2009 - 10:47 am
Muy bueno el codigo:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]
Me sirve de mucho, ahora surge otra pregunta,como hago para redireccinar a una pagina de error si el visitante coloca la extencion php??
#3 by David Esquivel on April 15, 2009 - 4:23 pm
Hola Dennis.
Porque no usas una extension .den o .d o la que se te ocurra y la configuras en tu .htaccess. Tambien funciona XD.
Gracias por el tip!
#4 by Jess on November 8, 2009 - 4:40 pm
No, you didn’t.
#5 by Rahul on December 7, 2009 - 4:51 am
The example is not working for me. sorry
#6 by Gio on February 26, 2010 - 8:28 pm
The example is for rubbish
#7 by gigantografias on June 6, 2010 - 4:19 am
Hola tengo estos dos codigos, en esta web http://www.remiserostudio.com/gigantografias
usaba error 404 en un php, ahora que solo he agregado algunas paginas de html a php basicamente las converti, ya no me funciona la pagina de error, ya que nose ve.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
#8 by zubair on July 28, 2010 - 7:04 am
Options +FollowSymLinks -MultiViews
DirectorySlash Off
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /(.+/)?index(\.html)?(\?.*)?\ [NC]
RewriteRule ^(.+/)?index(\.html)?$ /%1 [R=301,L]
RewriteCond %{SCRIPT_FILENAME}/ -d
RewriteCond %{SCRIPT_FILENAME}.html !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.+)\.html$ /$1 [R=301,L]
RewriteCond %{SCRIPT_FILENAME}.html -f
RewriteRule [^/]$ %{REQUEST_URI}.html [QSA,L]