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.
The 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.
@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.
Oh, 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.
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:
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.
No 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
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.
/user/account/edit-profileYour 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.
/user/account/edit-profile/index.htmlyou just have/user/account/edit-profile.htmland use .htaccess to hide the extension.As you can probably tell, I know very little in regards to messing about with .htaccess.
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-upOf 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.