Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-03-2014, 05:08 AM #1
Directories and Pages and Slashes
Is it correct that in the URL, a directory should end with a slash, and a webpage does not require one?
www.debbie.com/legal/tax-law/ (Where Section = "Legal" and Subsection = "Tax Law") www.debbie.com/legal/tax-law/be-sure-to-charge-sales-tax (Where Article= "Be Sure to Charge Sales-Tax")
05-03-2014, 05:27 AM #2
- Join Date
- Sep 2011
- Thanked 26 Times in 26 Posts
Short answer to them: No (both)
It depends on how the site is setup.
For instance, some PHP engines (codeigniter for example) give meanings to each part. For instance
example.com/news/article/2could call a php class named "news", call the function "article" in that class (if it exists) and pass 2 to the function as a parameter. This is a lot easier and more dynamic than creating a directory "news" and then a sub-directory for "articles" in that, finishing off with a file for every article containing the data. Another way would be having the first argument ("news" in this case) include a file, which could load a template for articles and pass data to it for article 2.
There's many ways you could handle the data and there are many possibilities, some are clean and both user and developer friendly, while others not so much.
Overall, in a basic setup, you don't NEED the trailing slash for a directory, but if a file with that name exists, then it will take over, so it's better to use the trailing slash (although the chances of you having the file without an extension or the path with a period are slim, it's still possible).
The site may redirect you and add the trailing slash on its own, I'm not too sure on that though.