The default unclean URLs that Drupal provides with question marks lurking around, could be annoying. But it does offer an option to have clean URLs.
Step 1
Check whether the rewrite module for your apache is enabled. Assuming you have an apache2 installation, you can do this by
ls /etc/apache2/mods-enabled/If you don’t find rewrite.load, it means that the rewrite module is not enabled. Drupal’s clean URLs feature requires this module to be enabled. In ubuntu / a debian based machine try..
sudo a2enmod
This will ask you the enter the module to be enabled. Type
rewrite and press entersudo a2enmod
This will ask you the enter the module to be enabled. Type
This can also be done as
sudo a2enmod rewrite
This can also be done like this (say for a non-Debian based OS):
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load
There! We have enabled the rewrite module for apache.
Step 2
We have to edit /etc/apache2/sites-available/default. Look out for the following lines.
Options Indexes FollowSymLinks MultiViewsStep 2
We have to edit /etc/apache2/sites-available/default. Look out for the following lines.
AllowOverride None
Order allow,deny
Change AllowOverride None to AllowOverride All. Save the File.
Step 3
Make sure that the .htaccess file under your Drupal installation folder has the following lines
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Step 4
Restart the apache server sudo /etc/init.d/apache2 restart
Step 5
Go to your Drupal administration page for clean URLs and enable them.
No comments:
Post a Comment