URL length and SEO
URL length is pretty straightforward; the main rule is to keep it as short as possible. Defining a clear folder structure early on in your website build plays a very important role. If you end up making your website unnecessarily deep then your URL’s will end up longer because of the deep folder structure. Smaller URL’s look a lot better in the SERP and are easier for users to read. URL’s that are easier to read for users will also be easier to remember. While the length of your domain name can dictate a lot in terms of the length of your page URL’s, with a bit of thought and planning you can slim down your URL’s into easy to read and easy to remember lines of text.
Keywords in a URL
You page should usually have its main keyword or topic within the URL. In some cases your URL can end up very long if the page topic is something that is really specific and needs a long sentence of text. In this case its fine to have a long URL but generally a good rule of thumb is try to have your page URL a couple of words long so you have a much shorter URL but as stated above there is exceptions to the rule. Try not to have URL text that is completely unrelated to the page or URL text that contains a lot of stop words (the, at, is, are examples). While it is good practice to avoid stop words in URL’s remember if you remove all stop words from a fairly lengthy URL you could make it unreadable and it might not make much sense. Any text contained within your page URL should be relevant to the main theme of the page and when you are building your URL’s try to stay away from including words which have no benefit in terms of keyword targeting.
If you have URL encoded white space (%20 or +) within your URL’s and if you want your URL’s to look slightly better you can look at using a hyphen (-) instead of a URL encoded white space. A hyphenated URL looks much cleaner when displaying in the SERP and is easier for users to remember and type. Using hyphens in URL’s can also greatly benefit keyword matching within the URL. Avoid using underscores in URL’s. Keyword matching can be unpredictable in URL’s with underscores. The longer the URL the easier you want to make it to read and to type. While you may run into situations where you have to use characters in URL’s which are not letters, numbers, or hyphens, you may want to look at URL encoding these characters. An example is a forward slash which is a URL reserved character and if you use it in your URL it will cause issues as it will be read as a folder forward slash. The PHP url_encode function is something you will probably use a lot when dealing with URL’s however you should also get into the practice of building URL’s within hyphens whether through str_replace or similar.