Friendly and Clean URLs with Drupal and Netfirms
Submitted by admin on Mon, 12/31/2007 - 21:14.
Having trouble getting clean URLs for Drupal working on netfirms.com hosting? Here is a working solution:
First step, update Drupal's default .htaccess file by replacing:
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
# RewriteBase /drupal
WITH
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
Next, log into the database your using for Drupal using phpMyAdmin. Run the following SQL query:
INSERT INTO `variable` ( `name` , `value` )
VALUES (
'clean_url', 's:1:"1";'
);
Now, login to Drupal's administration screen. Click site configuration -> Site information. Change the title of your site (Just add the number "1" to the end of the title). Click save. Then remove the "1" from your title and click save again.
Congrats, Search engine friendly / Clean URLs should now be enabled in drupal.
Appendix: Exactly how does this work?
Because netfirms is a shared hosting provider, mod_rewrite can't properly set friendly URLs unless you force it to rewrite from the base URL "/". Hence the mod_rewrite modification at the top.
The second step is manually forcing Clean URLs on in Drupal. Drupal doesn't like netfirms' setup for some reason, hence the need for this step.
The final step is forcing drupal to recognize that you've manually changed a configuration variable. Drupal doesn't know that you forced on Clean URLs; in layman's terms, by changing the title variable you are forcing drupal to recheck the Clean URL variable, and recognize it has been forced on.
