When you try to develop a Drupal page and you’re rather new at it, you might find yourself running into difficulties in relation to the structure of the URL. Sometimes it’s hard to get your head around because the definition contains non-standard characters, such as diacritics or punctuation marks. When they appear in the URL path they don’t look too pretty, and in addition they may even confuse search engines, which might find it difficult to crawl a website with too complicated a URL path.
A clean URL will take you there
To give you an example, Drupal sets up automatically the path toward your log-in page for administration purposes asexample.com/?=admin This is only a simple example, where the path doesn’t contain too many elements. And yet, it might be difficult for the search engine to recognize this description. That’s precisely what you don’t want if you aim at gaining a good standing on the search engine’s query responses. So what’s to be done? Well, you need to clean up the path, so that the non-standard characters disappear from it without affecting the accessibility of the site, and the URL becomes friendlier towards potential users. If you do this, you might be aiming for a structure that looks like this: example.com/admin
Clearer, isn’t it? And how much easier it is to figure out what’s going on in this URL.
3 Steps To Enable Clean URL’s
So basically what you need to do is in fact fight (metaphorically, of course) against Drupal’s default settings, and clean up the paths of any cluttering or confusing elements. In order to set up clean URLs all you have to do is
- Sign in to your Drupal admin panel and go to ‘Configuration.’
- Under the ‘Search and Metadata’ column they have an option called precisely ‘Clean URLs,’ which you should have no problem recognizing.
- Click on that and find the ‘Enable Clean URL’ link.
Click on that one, and when the new list of options comes up go to ‘Save Configuration.’ That’s it, you’re done.
What path aliases are good for
When you have a number of different elements on your site and want your URLs to reflect that diversity you have the option of setting a so-called ‘path alias.’ What these do is generate a series of paths for your aliases that don’t change when you exit the base path, i.e. whenever you move away from the entry page into the more or less intricate structure of your site (tabs, links, blocks etc. that derive from the base path). When you do that you bump into unpleasant strings of machine-generated characters like the one seen above. That’s mainly because Drupal uses the modifier ‘node’ in the default setting of your URL path whenever it comes across a different piece of content on your site.
If we take the example of say a link to a post you are displaying on your site, you will be very likely to find a URL path like this: example.com/node/5
Here, 5 (or any other number you may find in the address) refers to the number allocated to that particular post among the elements of your site. The components ‘node/5’, while perfectly accessible and logical to the machine, doesn’t say anything to a human user, who has no idea what elements lies behind this description.
But if you want, for instance, to make it possible for users to see the actual title of your post, you can set up the path to contain precisely the title. In the example mentioned above, by setting a path alias you turn this impersonal path into something very specific, like, for instance: example.com/what-i-had-for-breakfast It’s already better, because you define clearly what that 5th node stands for.
When Adding An Article In Drupal, Click On URL Path Settings And Manually Enter An URL
Tip: You can use a Drupal Menu called Autopath to automatically do this for you
In order to reach this result go to the page editor (when adding content) and click on the link marked as ‘URL Path Settings.’ Here, you simply type in the section of text you want for your path alias (the equivalent of the what-i-had-for-breakfast bit in my example above). Simple as that. Good luck. For further information, check out Drupal’s own set of advise, available online.