|
|
Drupal Search Engine Friendly Urls
Default Drupal URLS
http://www.example.com/?q=node/45 is a sample url that Drupal has once installed. In order for it to become more Search Engine Friendly you can do the following :
Note : This works only on apache servers. Once you start you might find yourself in a situaltion when you won't be able to login. In that case use this URL : http://www.example.com/?q=admin/settings
Follow these three steps :
Step One :
Make Sure you have mod_rewrite enabled. If you are not sure please contact your host or this manual :
Apache Manual
Step Two :
Open your .htaccess file and put this code :
<Directory /var/www/example.com>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory> |
Or simply download this file :
htaccess
Remember to rename it to .htaccess after you upload it (no extension).
Step Three :
You should ensure your Drupal site has the path module enabled and the correct permissions set in order to create custom URLs. You can enable the path module in administer >> modules . You can then set permissions to administer URL aliases and create URL aliases . Enable clean URLs on your administration >> settings page. First, see if you can go to the settings page on your site using clean URLs: type in the URL http://www.example.com/admin/settings (where www.example.com is replaced by your hostname). If you get no errors and get to the same page you would have gotten to by clicking on "administer" then "settings" , then you know that you have setup the ReWriteRule rules successfully and can then click the Yes checkbox for "Clean URLs:" . If you have problem you can read the instructions to unset clean URLs . If you If you still have problems with clean URLs you can set the Drupal Settings.php $conf['clean_url']=1;.
Source : http://drupal.org/node/15365
|