Forum Moderators: mack

Message Too Old, No Replies

Page names

Using spaces in page names

         

microduma

5:52 am on Oct 3, 2004 (gmt 0)

10+ Year Member



Hi. I am new to webmasterworld, and anything but a web "master". I want to sharpen my skills and fix my site, and have found quality advice here (have been reading a while). I would like to know if there is any reason why I should not use spaces in my page names. I have been doing it, and have not picked up any problems that I am aware about, that is. I am concerned since I do not see people doing it. So, is it something that is OK? If not, It is just one thing on my site in need of attention, I basically need to re-build, and the site is already on-line.

Thanks.

mack

8:54 pm on Oct 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You should never leave spaces in file names or url's If you have a file "foo bar" name it "foo-bar" or "foo_bar". By leaving a space you really are giving your server a hard time, as well as the visitors web browser.

What you will notice is when you leave a space in a file name in the adress bar on the browser well add a "%20" where the space was. Am I right in assuming you are using an html editor to build your pages? If so then your editor is ensuring that the links are pointing to the right location. ie "foo%20bar" if you where to simply place a link to foo bar then this url syntax would be illegal and would result in a 404 page not found.

It is always a good idea to give your pages and files nice simple names such as contact_us.html about_us.html or even better about.htm and contact.htm

Hope this is of some help.

Mack.

microduma

9:18 pm on Oct 3, 2004 (gmt 0)

10+ Year Member



Of much help, thanks, and absolutely right in your assumption- Mozilla composer, which does not seem to be taken seriously around the pro's.
Thanks again.

g1smd

1:34 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Avoid spaces, as they get turned into %20 elsewhere.

Avoid underscores too, as they visually disappear in underlined links. Google doesn't treat the separate words as being separate either.

Use either hyphens or dots. This causes the least amount of hassle with servers, browsers, search engines, and your visitors.

Hester

3:55 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



File names with spaces in don't work in Netscape 4 IIRC. It's possible they fail in other older browsers too.

I've taken to using hyphens recently. I've built my site using another method though - capitals and lower case words with no gaps, eg:

ISaidHello.html

But now I realise I should have done the links like this:

i-said-hello.html

Why? Well one thing I found is that the following two filenames are identical to a browser!

ISaidHello.html
isaidhello.html

And yet you can upload both as separate files to a server! So clearly confusion occurs there.

With hyphens and lower case, I found another benefit. In Windows, it'll break the words (used below an icon on the desktop) where the hyphen occurs. Makes working with files easier.

About underscores - one reason not to use them instead of hyphens is that they require the SHIFT key to type in, whereas hyphens don't. So your visitors will thank you for that.

webdude

5:41 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ISaidHello.html
isaidhello.html

In Apache Linux, this would be perfectly acceptable. I don't think it is the browser that makes the difference, but the server platform and software.

Just another 2 cents...

g1smd

5:46 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> Well one thing I found is that the following two filenames are identical to a browser! <<

The webserver is the issue. Apache is case sensitive, as are most others, so This.File.html really is a different file to this.file.html but certain Windows (IIS?) servers are NOT case-sensitive.

That can cause all sorts of issues with page rank when some people link to you with differing case to what you wanted. Additionally, should you ever migrate the domain to an Apache server, all the incoming links using the "incorrect" case will suddenly appear as 404.

Recomendations: use all lower case for filenames, and separate the words with hyphens or dots (dots also do not require the shift key).

encyclo

5:58 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The webserver is the issue

In fact it's the underlying operating system of the server which is the issue. All Unix-type operating systems (Linux, FreeBSD, etc.) have filenames which are case-sensitive. Windows servers (even when running Apache) are not case-sensitive. The trouble comes when you develop on Windows then upload to a Unix-type server.

As most shared hosting packages are running on Linux or FreeBSD servers, not Windows, it is a very good idea to make sure to keep all your filenames lower-case just to be sure.

microduma

6:44 pm on Oct 4, 2004 (gmt 0)

10+ Year Member



Thanks for the advice, it sure provides some perspective.

webdude

7:11 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ISaidHello.html
isaidhello.html

In Apache Linux, this would be perfectly acceptable. I don't think it is the browser that makes the difference, but the server platform and software.

Just another 2 cents...

I guess I didn't make myself clear. When I said acceptable, I meant you can use either of these on Apache on linux. Both are considered different. A link to ISaidHello.html would go to ISaidHello.html and a link to isaidhello.html would go to isaidhello.html, both being separate documents.

Just trying to make myself clear :-)

Hester

8:27 am on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But the link won't work if it's clicked on in a browser! My web host use a Solaris server with PHP etc, where I was able to upload two files with the same name, one with upper-case lettering, one all lower-case. But trying to click on either link from a page always took me to the same file! In other words, there's no way to differentiate between the files when using a browser (at least not the ones I tried it in).

webdude

1:23 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mmm...

I never really ever tried that. I always assumed that the links would be correct. I can't really test it now because I have gotten rid of all my Linux boxes. But I do remember that I had to get the case right or the browser wouldn't find the link.

In other words, a page called ThisPage.html with a link <a href=thispage.html> would result in a page not found. I remember this because I got a site that was originally on IIS4 and when I put it on Apache Linux, I had to go and change the case of all the pages because the links didn't work anymore. So I just assumed that you could have 2 links named the same but with different case and they would link correcly.

Interesting.

encyclo

1:33 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hester, it may be that your host was using "mod_speling", which makes filenames case-insensitive on the server-side in a UNIX environment such as Solaris.

If you have two files on a UNIX-type server: HelloWorld.html and helloworld.html, they are completely different files. URIs are case insensitive for the domain name up to the first trailing slash, then (maybe) case-sensitive afterwards (depending on the server). So, to access each file, you would link to:
[example.com...] or
[example.com...]

It is always best to stick to lower-case only to avoid problems.