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 ??? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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!? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.