Drupal 7 subdomain clean url in Godaddy

This is a guide on how to install Drupal 7 in a subdomain. Here is the situation to avoid misunderstanding.

You already have Drupal 7 website installed in the webroot. The clean url is working fine. Now you want to install a second Drupal 7 website in a subdomain.

So here is a guide on how to install a Drupal website in a subdomain (specifically in Godaddy shared hosting).

Step 1 - Create a new subdomain using Godaddy tool (Hosting Control Center - More - Hosted Domains). Click "Manage" Subdomains and create a new subdomain. For Example here, we named it "drupal2". So your subdomain url will be "drupal2.yourdomain.com".

Step 2 - Create a new database for the second Drupal website (Hosting Control Center - Databases - MySQL).

Step 3 - Extract latest Drupal core in the subdomain and do a fresh install.

Step 4 - After finished installation, go to Administration Page. Click Configuration and choose Clean URLs under SEARCH AND METADATA. Try run and check Clean URL. If it failed, then open File Manager and edit ".htaccess" file from the FIRST DRUPAL WEBSITE in the "webroot" directory. Add the line below:

# Add this lines
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal2/
RewriteRule ^ /drupal2/index.php [L]

# Existing rewrite rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

before the existing rewrite rules.

Step 5 - Enable RewriteBase / in the same file (.htaccess in webroot)

# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
RewriteBase /

Step 6 - Save ".htaccess" file. Now, manually change the URL from:

drupal2.yourdomain.com/?q=admin/config/search/clean-urls

to:

drupal2.yourdomain.com/admin/config/search/clean-urls

and see if it displays the "Enable Clean URLs" checkbox. If it does, select it and Save Configuration.

This is how we help configure a friend website. We don't change a thing from ".htaccess" file of the subdomain Drupal website. It work for us and we blog it here for our reference and maybe help other people too.

We did change "settings.php" file from Drupal2 subdomain though. Here are things we change/add:

# $base_url = 'http://www.example.com'; // NO trailing slash!
$base_url = 'http://drupal2.yourdomain.com';

and

# $cookie_domain = '.example.com';
$cookie_domain = '.yourdomain.com';

That's it.

Tag: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.