jcvenom Posted September 3, 2013 Share Posted September 3, 2013 (edited) Ok guys have you ever wondered how some sites urls are e.g mydomain.com/home instead of /home.php or html ? Well for people who don't know this they use a haccess or .htaccess now if you want your url to be like for example home instead of home.php then here is my tutorial (can be any file once its in the directory). 1.)Ok first look for a file in your main Directory by default the directory is Public_html on Cpanel if files does not exist the create a file called .htaccess 2.) Open the htaccess and add this line of code below #---- Made by Jcvenom ---- #---- Establishes a custom 403 error ---- ErrorDocument 403.shtml #---- Prevents directory from listing in all folders ---- IndexIgnore * #---- Makes page render(work) without extensions example php or html or asp etc ---- Options +MultiViews #----End of code do not claim this is yours & do not sell---- That should make your Urls work without extension before: mydomain.com/test.php After: mydomain.com/test Both Urls will still work Edited September 3, 2013 by jcvenom Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted September 3, 2013 Share Posted September 3, 2013 This is un-efficient. By using "Options +MultiViews", you put more strain on your server, by making it "compute" and "find" the file it must serve. You should be using mod_rewrite for this. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted September 3, 2013 Author Share Posted September 3, 2013 This is un-efficient. By using "Options +MultiViews", you put more strain on your server, by making it "compute" and "find" the file it must serve. You should be using mod_rewrite for this. yes you can use mod_rewrite but mod_rewrite may not be activated some hosts and only works on a Apache server Quote Link to comment Share on other sites More sharing options...
Seker Posted September 3, 2013 Share Posted September 3, 2013 yes you can use mod_rewrite but mod_rewrite may not be activated some hosts and only works on a Apache server Then, perhaps you should state that in your "tutorial" (Really, it's just an example). Just for clarity's sake. Something like... "This is definitely not the most efficient, but if you have no other option, you can do this." should work. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted September 3, 2013 Author Share Posted September 3, 2013 Then, perhaps you should state that in your "tutorial" (Really, it's just an example). Just for clarity's sake. Something like... "This is definitely not the most efficient, but if you have no other option, you can do this." should work. this is a simple way of doing it but there is a advanced way where it automatically hides the extension but this is just a simple way Quote Link to comment Share on other sites More sharing options...
Barrikor Posted September 3, 2013 Share Posted September 3, 2013 If it's not a memory-intensive site and you know what it's doing then MultiViews is a valid method to use. You'll also want to set a 406 error page if you've got MultiViews turned on. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted September 3, 2013 Author Share Posted September 3, 2013 If it's not a memory-intensive site and you know what it's doing then MultiViews is a valid method to use. You'll also want to set a 406 error page if you've got MultiViews turned on. ok i should Quote Link to comment Share on other sites More sharing options...
Dave Posted September 6, 2013 Share Posted September 6, 2013 A somewhat hacked solution in my opinion. I'd suggest routing everything through index.php and within that file determine which controller to serve to the user. 1 Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted September 9, 2013 Share Posted September 9, 2013 A somewhat hacked solution in my opinion. I'd suggest routing everything through index.php and within that file determine which controller to serve to the user. +1, to probably the better idea. This way, you can intercept the controller that is being served for log purposes, or anything else really. 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.