I have been reading on here and Google results for a few hours now including this question and the links therein and many others. Including a URI building styleguide from the w3c and others.

I have settled on a format, I understand about apache, redirects, file extensions, and SEO. I am pretty sure (and it seems to be confirmed in the link to the Google Webmasters in the first question) that I understand but it just seems wrong...

example.com/directory/specific-page/ is OK for a file, right? (with trailing slash "/")

It doesn't necessarily mean that it is pointing to the index or default file in the /specific-page/ folder, right?

It is significant mainly because while I am using blogging software for my blog, I am hand-coding (to retain more control) the rest of the site. It is entirely plausible to me that WordPress would, rather than creating pages/files would actually create directories with index/default pages in them.

Up until now, I always thought that the trailing slash pointed to a directory's index page but that appears not to always be the case, is this correct?

Sorry, I feel like this topic has been well-discussed, but that is part of what is causing me problems.

I should note, I was leaning towards omitting the trailing slash from all pages, CMS generated or not, until I found this article from 2008 about the lack of a slash causing problems with Pingbacks in WordPress.

  • Hi all, sorry for my--in retrospect--poor wording, as the people who have answered this question figured out, when I said "file" I really meant page as in 'mypage.html.' While my phrasing was poor, I did realize that other file types (for instance .pdf) should be designated as such. Sorry for the confusion.
    – adam-asdf
    Aug 22, 2012 at 6:39

2 Answers 2


The key point to understand here is that a URL is an abstract concept. In fact, they should technically be referred to as a URI (Uniform Resource Indicator, rather than Uniform Resource Locator).

In short, when a browser or user-agent makes a request to a URI, the server can return any content, with any headers.

mysite.com/directory/specific-page/ is OK for a file, right? (with trailing slash "/")

If you mean a binary file like an image, document or zip file, it should be avoided. As described above it's technically possible to serve files this way, but it could be confusing for users. Use an actual file name if possible.

If you mean a web page (HTML file), yes it is fine.

It doesn't necessarily mean that it is pointing to the index or default file in the /specific-page/ folder, right?

Again, you can make the server return whatever you like. It just happens that returning an index.html is the default behaviour on most servers.

Up until now, I always thought that the trailing slash pointed to a directory's index page but that appears not to always be the case, is this correct?

Yes. Apache will usually look for a folder in the specified location but there does not have to be one there if you configure something different via htaccess. And the "index page" could be any file.


No, a trailing slash is not acceptable for files.


You're going to need to set up canonical names on Apache.

Now, what you're talking about is simply a sort of redirect. A canonical name is simply an alias of another name. So, if you want to reference a file, it would be mysite.com/directory/specific-page/ is an alias to mysite.com/directory/pages/specific-page.php.

Files are always referenced with an extension. The reason for this is because of MIME types, so the browser knows what to do with the file that is delivered from the server.

It sounds like you've been in learning mode for a while now, and I don't want to information overload you, however you might benefit from learning how the client/server relationship works. This will help you visualize exactly what is happening when someone requests your site (thus making all of the other stuff simpler).

  • OK, I read all of the above, and a fair amount of the apache docs on mod_rewrite for the version my server uses. MIME types and the basics of a server I was familiar with, and much of the MIME type configuration is included by my host (I am also using HTML5 Boilerplate). So let me summarize, clarify, and ask...While the file on my server will always have a file extension (and therefore a MIME type), I can use mod_rewrite to point a URL without a file extension and with a trailing slash to exactly where that file resides, correct?
    – adam-asdf
    Aug 21, 2012 at 12:15
  • I also noticed in the Apache FAQ that you cannot make a url case insensitive, but I also noticed the "[NC]" flag, I interpret this as you can make the matching to what you'd use on the web match (the canonical link) any case but not the path the the file. Is this correct?...Last but not least, if I create a canonical rewrite rule, is it safe for me to skip adding one to the header of my html documents? I think, I got it, just want to be sure because this is brand spankin' new to me.
    – adam-asdf
    Aug 21, 2012 at 12:23
  • After processing a bit more (the /pages/ folder in your example threw me off)...I was thinking about how I don't explicitly set the file path. Since I'm on shared hosting my entire account resides in a directory that is a directory above my /public_html/ folder (my site). If I am interpreting all this correctly, my folders and files are arbitrary (to the server) and are themselves canonical names that I have designated for wherever the file actually resides. Which explains why a trailing slash wouldn't really matter and why empty folders don't FTP (they are meaningless). Once more: Correct?
    – adam-asdf
    Aug 21, 2012 at 13:22
  • 1
    Canonical names are simply to aid in SEO and for the users. The trailing slash won't ever be on a file because that would make the file extension different (e.g. .txt/, .html/, .aspx/) and the browser (and server) won't know what to do with it. However, the canonical name itself may contain that trailing slash. To make it easier for users and more confusing for developers (the common trend), the trailing slash can be used for a myriad of purposes - one being for folders. You should put the canonical meta tag in your HTML documents for SEO (to not link to duplicate content). [Continued...] Aug 21, 2012 at 13:37
  • As for your last question, the /public_html/ folder in your server is common. Imagine the directory /public_html/ as being a sort of root. It's like the C:/ drive on your computer, but one step above that. As far as your website is concerned, everything is contained inside of /public_html/, so there's no point to reference it. Anything above or outside of your /public_html/ folder is all server-side files (or FTP). I would caution against deleting any folders above /public_html/ as it won't harm you and it might be there for an important reason. Aug 21, 2012 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.