- This topic is empty.
-
AuthorPosts
-
February 12, 2012 at 2:55 pm #36621Ricardo C.Participant
How do I code in order to get something as the following: http://www.xxxxx.com/xxxxx/xxxxx
after the domain name the forward slashes? Hope my question make sense to those who are reading it. Any sort of help will be much appreciated. Thanks in advance.February 12, 2012 at 5:08 pm #96588joshuanhibbertMemberThe typical way to do it is to use a folder structure, where xxx is the name of the folder, and then you have index.html in the final folder.
February 12, 2012 at 5:12 pm #96589SgtLegendMemberThe way this is typically done these days is by using the mod_rewrite module in Apache and a .htaccess file, creating sub-folder after sub-folder can lead to problems updating code or page structuring where as a .htaccess file allows you to create a virtual URL that points to a real file.
February 12, 2012 at 5:46 pm #96591joshuanhibbertMember@SgtLegend Out of curiosity, what are the actual problems with the good old folder setup? I have never heard of any problems myself.
February 12, 2012 at 6:59 pm #96592SgtLegendMember@joshuanhibbert – I’m not saying there is anything wrong with it in general but the underlying problems are that if you have a folder structure such as the following:
/user/account/edit-profile
Your creating a redundant folder structure which is harder to maintain because of the deep linking process your trying to use, the advantage of mod_rewrite is you can keep the same link but have the file it reports to within a single folder that is easy to manage and update.
Another advantage of mod_rewrite is you don’t have to update any folder names as if you change a URL you can simply use a RewriteRule to redirect users from the old URL to the new one without ever having to create a new folder and such.
February 12, 2012 at 7:07 pm #96593joshuanhibbertMemberOh, right. I misunderstood. And I agree 100%; that’s how I prefer to do it too. Rather than having
/user/account/edit-profile/index.html
you just have/user/account/edit-profile.html
and use .htaccess to hide the extension.As you can probably tell, I know very little in regards to messing about with .htaccess.
February 12, 2012 at 10:34 pm #96603SgtLegendMemberSorry to highjack your thread ricky122892…
The way i normally structure rewrite rules is based on the controller and method i want to target, for instance using your above example instead of continuing to call a .html file that’s based on the original name i would do the following:
/user/edit
/user/login
/user/log-out
/user/sign-up
Of course in the end it’s a personal preference but i tend to follow MVC standards which are again based of a controller and method pattern, a great example of this in action is the Symfony framework which makes great use of custom URL’s based off two arguments given in the routing table.
February 12, 2012 at 10:55 pm #96604joshuanhibbertMemberHeh, that might as well have been in gibberish. I’m a front-end dev so I leave that sort of stuff to people who know what they are talking about ;)
February 13, 2012 at 12:13 pm #96628Ricardo C.ParticipantNo need for apologies, for I learned i gained knowledge from your conversation also learn from , though I do very much appreciate the both of you for your advice, thank you very much, best regards to the both of you
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.