robert_gsfame Posted June 5, 2009 Share Posted June 5, 2009 I want to hide .php extention so it's like www.blabla.com/index instead of www.blabla.com/index.php Does anyone know how to do this? please tell me in detail cause i'm still a newbie ??? Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/ Share on other sites More sharing options...
GingerRobot Posted June 5, 2009 Share Posted June 5, 2009 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 More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 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 More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 I do it on bigger projects for improved seo, hierachy, and for it just looking nice Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850094 Share on other sites More sharing options...
robert_gsfame Posted June 5, 2009 Author Share Posted June 5, 2009 are you sure? but most people said that it will help securing the site.. do you know how to use .htaccess? Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850095 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 GingerRobot is right, it won't help security. Why would it? Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850096 Share on other sites More sharing options...
robert_gsfame Posted June 5, 2009 Author Share Posted June 5, 2009 so gevans, tell me how to use this .htaccess? please explain to me..how to create this file, where to put n why i have error message, it says "CGI problem"..Help...HELP Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850101 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 please explain to me..how to create this file, where to put n why i have error message, it says "CGI problem"..Help...HELP 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 More sharing options...
robert_gsfame Posted June 5, 2009 Author Share Posted June 5, 2009 when i put .htaccess in my root folder, my index.php appeared with that error or what's wrong with that? Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850110 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 You may not have your server set up with .htaccess enabled http://blog.taragana.com/index.php/archive/how-to-enable-use-htaccess-nice-permalinks-in-apache-web-server-on-windows/ Have a look at the above, I'm assuming that you're using an apache server on windows!? Link to comment https://forums.phpfreaks.com/topic/161092-hide-php-extention/#findComment-850113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.