Drupal Tip #1 – Importing and Clean URLs

Posted by in News, Software, Tech, Tips

I had the recent pleasure to try out DrupalGardens.com to create a site for my mom’s archery shop. First, DrupalGardens.com is great. You can easily create a fast Drupal website for free and then they allow you to export it to your own webhost if you like or keep it on their servers.

OK, this is not a commercial for DrupalGardens.com so I’ll leave the accolades at that.

My point of this article is in the importing and hosting on another webhost, and in this case it’s 1and1.com .
The DG export includes the drupal core installation, themes, and all your content as you configured at DG.
I was able to successfully import the database, load the files to the site directory using FTP, re-mapped the domain to the new directory and attempt to get to the home page in my browser.

My first obstacle was the php version, I got a 500 error at the index page and discovered I needed php 5 to run the site. 1and1 now allows you to set the php version default for all your sites; however, I have too many site and didn’t know which ones were running on what, so I didn’t want to make that change right now. So, this is an easy enough fix and I just needed to add AddType x-mapp-php5 .php to my .htaccess file.

My second obstacle took a bit more time and is the reason for writing this post. It took me about 3-4 hours to find but took about 3 minutes to implement.
The issue was that I could access the front page only and all others would throw a 500 error. This is due to clean-urls being turned on and the pathing not set properly.

When importing a Drupal site from drupalgardens.com to 1and1.com, make sure you’re on php 5 or add the command earlier in the post and,,, ready for this? In the same .htaccess file that you get from DG, un-comment the line below by removing the “#” and saving it back to the site.

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

That was all I needed to fix the site and all pages show as they should and clean-urls are still active.

I’m not positive, but if I would have turned off clean-urls previously in the drupalgardens.com site before exporting, I may have had a functioanl site to begin with; however, I would have run into the same issue had I turned them on later.

I hope this helps someone else in the future when the need to import a drupalgardens.com site into 1and1.com and find that clean-urls are causing an issue.