Jump to content

Hide .php extention


robert_gsfame

Recommended Posts

Assuming you have an apache webserver, you could use mod_rewrite to do something like this.

 

But on a different note, why would you want to? A few people have asked this sort of thing before because they felt it would add some sort of security -- it wont.

Link to comment
https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850090
Share on other sites

This is done using a .htaccess file, not php.

 

http://corz.org/serv/tricks/htaccess.php

 

that's a pretty good resource.

 

The quick way to do what you want is using the following;

 

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-z0-9-]+)$ $1.php [L]
RewriteRule ^([a-z0-9-]+)/$ $1.php [L]

 

That will push anything (as long as it only contains numbers, letters or dashes) to itself with a php extension

Link to comment
https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850093
Share on other sites

please explain to me..how to create this file, where to put n why i have error message, it says "CGI problem"..Help...HELP ;D

 

How... Open a text editor, hit save as, call it .htaccess

 

Where... usually at your server root directory, if that's where you want it as well happy days!

 

Error Message... does this have anything to do with the topic at hand?

Link to comment
https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850107
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.