A fresh Drupal installation would be having URL (Uniform Resource Locators) of the following fashion:
http://www.wisetome.com/?q=node/1
Since Drupal is a CMS that stores all the page and other content data in the database, it has to pass details to the main index.php of what page needs to be fetched. In effect, Drupal will be showing only one page, with dynamic data depending on the parameters passed. If a parameter has to be passed, it is done so by attaching a /?q=parameter to the domain name. So how do we go about making the URLs from something that is above, to a much more user friendly format given below?
http://www.wisetome.com/about-wisetome
We can use some configuration changes, a core module and a contributed module to achieve this.
Configuration changes
Note - you may need to provide write permissions for the .htaccess file in your root folder of your webhost account.
This will change it to something that will eliminate the ?q= by using some URL rewrite rules.
http://www.wisetome.com/node/1
ULR aliases - Path module
You can use the core module, Path, to rename the path to whatever you want.
After you do this, when you edit a node (page, story, etc), or create a new one, below the content, you can specify custom URLs in the 'URL Path Settings'. You can even manage all the URL aliases by going to Home > Administer > Site building > URL aliases.
Automatically generate URL aliases
There is another nifty third-party module that allows you to generate URL aliases on the fly (and also for the content that is already created). This is a must have, and I use it for every Drupal installation.
The contributed module can be downloaded and installed from Pathauto project page at Drupal.org. After you download the version that is compatible for your Drupal installation version, uncompress, and upload it to your 'modules' folder in your webhost, it will be visible in the Modules section.
Remeber to configure it every time you add a new type of node since it can be configured specifically for a type of node.
Once I had set this up, it automatically generated the URL for the about page of WiseTome.com:
http://www.wisetome.com/about-wisetome
Why go for pretty URLs?
Other than the stand point of how it is visible to search engines, it is user friendly. It makes more sense for users when they look at the URL regarding where they are with respect to the homepage.
Add new comment