URL Aliases

"URL" is an abbreviation of "Universal Resource Locater." It is a fancy way of saying "my page's address (or name) on the web." It is the "name" by which a browser identifies a page to display. We've all seen advertisements that say "Check us out at abcxyz.com." Well, abcxyz.com is a URL for the home page of their web site (well, sort of - there is an implied add-on to that, such as index.html).

By default, Drupal calls your content "nodes" and identifies them by their position in your database. So your page on "The History of the Macadamia Nut - Part 1" might be known as "node/167." That's all fine and well for Drupal, because it understands that. But your visitor really doesn't care where the page is in the database; all they want to do is find the page again, or know what the entry in their bookmarks list is.

So Drupal has a feature called "URL Alias" that allows you to provide a more understandable name to the content. As far as browsers, servers, and search engines go, it is totally unnecessary. But for humans, it is nearly mandatory. This is why I tell people to always turn on the Path core module, which supports URL Aliasing. (I will mention another module shortly, called Pathauto.)

So, just before you submit that exhaustive treatise on macadamia history, and if you have the Path module enabled (I told you that you'd want it), then you'll see a section on the edit page that says "URL path settings." So let's say you want your visitors to see it as http://www.mysite.com/MacadamiaHistory.htm. In the URL field, you enter MacadamiaHistory.htm.

Now, some people will argue that putting that ".htm" on the end is not necessary. That's absolutely true. But then it's not necessary to do any of this. My opinion is that if you want your visitors to see a "normal" name, it should look like a normal WEB name. Web pages have some kind of type, such as ".htm" so we should too. But it's your preference.

Oops, forgot to do this before you submitted the page? Not to worry - Drupal to the rescue!

First, visit the page you created. In your browser's address field, you'll see its URL. On the end it will probably say "node/xxx" where xxx is some number. Write down that number. Now go to Administer>>Site building>>URL Aliases. There's an "Add Alias" tab at the top. In the top box (sorry, they seem to have dropped a label in 5.1), enter "node/xxx" from above. In the second box, enter "MacadamiaHistory.htm".

Now go back and visit that page and look at your browser's URL field.

If your site is going to have lots of content, particularly user-submitted content, you might want to looks at the PathAuto module. Not only will this module automatically generate URL aliases for new content (according to rules you can set up), but can even go back and change aliases in bulk.

 

Comments

**.html

i do agree that for ease of use you should put ".htm" however you should also bring to lite that people using php could use ".php" and so on so forth like you pointed out not nessacary but then again non of it is...lol