Imagine my current flat-file no-CMS website with an URL like http://example.com/en/tomato.

This is of course very unsexy and could be anything really from tomato soup, tomato the music band, tomato the movie, or more unlikely but still... just about tomatos!

So, I want to make it more specific for both real humans as well as search engines. Given: both the language code and short filename code are essential and cannot be replaced so somewhere there has got to be en and tomato preciding/following whatever delimiter like / for .htaccess to do the correct invisible redirects to /tomato.php?language=en.

Some options occured in my mind for the added words in URL:

A   example.com/en/tomato/just-about-tomatos
B   example.com/en/tomato/just-about-tomatos.htm
C   example.com/just-about-tomatos/en/tomato
D   example.com/en/tomato_just_about_tomatos
E   example.com/en/tomato-just-about-tomatos

Question1: Which of these is the best for humans as well as search engines?

Question2: Which single elegant rule should make this happen in .htaccess?

Thanks for your suggestions and answers! Much appreciated.

5 Answers 5


I think you might have selected the best answer prematurely?

Question 1:
My pick would be example.com/en/tomato/just-about-tomatos - my rationale being:

  • /en/ is a primary language folder that encompasses all of the content therein so is best suited to appear directly after the domain, and is the best choice for multi-lingual implementation after a) new domain, and b) sub-domain.
  • /just-about-tomatos is the page - so should reside at the end. There is no need to write .htm at the end since you're rewriting the URL and users DON'T CARE what language/platform you use.

Question 2:
In order to add the just-about-tomatos part into your URL you'd probably have to look at creating a mapping system since that phase doesn't appear in your existing URL.

  • reconsidered your suggestion as the best answer, indeed! One final question: would it be allright to have the last part ( which can really be anything) textual wordst with spaces? <a href="/en/tomato/just about tomatos">....</a> or should absolutely spaces be avoided and replaced with dashes - ?
    – Sam
    Commented Mar 7, 2011 at 15:38
  • 2
    Spaces cannot form part of a web filename/URL (unless encoded) and are not considered best practice (as a space indicates the end of the URL), and at the very least (if you must use them) should be encoded with %20. I'd definitely go with hyphens (dashes) every time. Commented Mar 8, 2011 at 1:15
  • +1 for that little clearification. Besides dashes - what other optione are there? Are + better than dashes? urlencode function of PHP uses them by default it seems... what do you recommend on this issue? Thanks very much
    – Sam
    Commented Mar 8, 2011 at 4:37
  • + will do just as well in most situations, however it seems that Google (and most other publishers incl SE) has chosen the hyphen side of the fence - goo.gl/7ZFtV Commented Mar 8, 2011 at 5:37
  • 1
    @Sam - I can't see anything wrong with it - it could possible look a bit spammy when you start repeating words unnecessarily though. Commented Mar 16, 2011 at 22:12

Just want to clarify what Eric Vold write about the parameter (?lang=en)

Turns out that Google does not recommend using this kind of parameter as it is confusing for visitors (and other factors).

The best option from your list would be A as seriocomic suggested, but even better if you put it this way:


  • @aji, +1 for reading my mind on that lang.website.com/etc, BUT I did not write down this option since I dont know how to make this possible via htaccess / my pesk account with shared hosting... Though this question is just about which method would be best, it would be realllly cool if you woule suggest how to make this happen. Thanks anyways for your suggestion!
    – Sam
    Commented Mar 16, 2011 at 11:21

The URL should be as descriptive as possible and it should in context with the contents it display. I also work on SEO URLs alot and I think to my knowledge option B is good.

B   example.com/en/tomato/just-about-tomatos.htm
  • Based on your rationale, all 4 suggestions made by the questioner are suitable? Commented Mar 7, 2011 at 3:46
  • 2
    It seems strange to me that you would pick the one with a file extension.
    – UpTheCreek
    Commented Apr 28, 2011 at 10:29

Using hyphens is good for SEO and this technique is favorable for SEO type URL writing. We use different types of URL's but they are not supportable for SEO.


the .htm is good because it lets users know what file type the page is. I wouldn't suggest using /en/ in the url because you want all users to come/link to the same page regardless of the language, and simply have the language changed via url query string paramater.

So I would suggest:


  • 1
    This is pretty fuggly - 1) why have a querystring when you can rewrite it in a more friendly way? (He's already rewriting the URL!) 2) Why does the user care what 'file type' the page is?
    – UpTheCreek
    Commented Apr 28, 2011 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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