[tips'n'tricks] Enable CLEAR URL for drupal CMS using .htaccess
Another share to what I’ve done during my sidejob project i.e. to enable .htaccess for Drupal CMS.
My server configurations for drupal CMS are mention below:
1. It’s part of the main URL (you can say it “subdirectory” with alias on httpd.conf) and my httpd.conf settings :
…
Alias /kampret/ “/var/www/html/drupal-6.6/”
<Directory “/var/www/html/drupal-6.6″>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
…
so to access my drupal it will be “http://main-url.com/kampret/”
2. I’ve enabled the mod_rewrite capability on httpd.conf by defining configuration as below :
…
LoadModule rewrite_module modules/mod_rewrite.so
…
AccessFileName .htaccess
…
<Files ~ “^\.ht”>
Order allow,deny
Deny from all
</Files>
And next, to enable CLEAR URL capability for drupal just make sure the file .htaccess under my drupal root document is exist, for my case it should be under /var/www/html/drupal-6.6/.htaccess
If .htaccess already there, so you just need to
1. un-comment and change line containing :
…
# RewriteBase /drupal
…
to become like below (please make sure that it use the same pattern as your alias for subdirectory on httpd.conf, in my case I use “/kampret/” as alias):
…
RewriteBase /kampret/
…
2. restart httpd service by issuing this command (for redhat / fedora based distribution) :
[apache@kampret] $service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
3. Go to your DRUPAL ADMIN PAGE and then open Administer –> Site Configuration –> Clean URLs, choose ENABLED and the SAVE IT !!!
Done!!! Hopefully, this can be useful for everyone who may need this kind of howto, thanks
I don’t have yet clear ideas about how to set my drupal 6.10 clean urls:
1) in my drupal root folder I don’t have the file httpd.conf I need to add it?
2) my mod_rewrite is enalbled , so I suppose to don’t need to LoadModule rewrite_module modules/mod_rewrite.so
3) how to restart httpd service using centos in vps?