tidystorm

random techno-gab

I rescued my WordPress site with a WAMP test server

What led to this:

In February of 2012, I had two wordpress sites, built with the techozoic theme, which were broken for a variety of reasons, including a backlevel of techozoic and an importbuddy done without first deleting the files.

What I decided to do about it:

I thought that a good remedy would be to set up a WAMP environment for the purposes of debugging, and so that in the future, I would have a test server (also known as a staging server.)

Because I want to ultimately have two websites in WAMP, I will run a single install of Apache, MYSQL and PHP and then I will set up two different instances of my wordpress install. This set of instructions covers mikemoran, and assumes that you will follow the same steps for biznology.

For more information:

See this website: http://sixrevisions.com/web-development/install-wordpress-on-your-computer-using-wampserver/

The specs:

(It’s important that the PHP versions be as close as possible to that of the live server, but especially the PHP version in WAMP should not be far behind that of the production server. The WordPress versions must match exactly. The Apache and Mysql should be as close as possible.)

  • WordPress 3.3.1 in both
  • PHP 5.2.17 in Production, PHP 5.3.9 in WAMP
  • Apache 2.2.21 in both
  • Mysql 5.1.56 in production, 5.5.20 in WAMP

Starting on Valentine’s Day, 2012, I set out on these steps to rebuild my mikemoran.com site in WAMP. These instructions developed and morphed over time. This post serves as documentation for myself of what I did. If it helps someone else, that’s great.

  1. Set up WAMP
    1. Note in advance that Secunia will probably flag elements of WAMPSERVER. It is not necessary to put the patches on unless you plan to use WAMP to support a live site.
    2. Download and install WAMPSERVER 2.2 in the default directory C:\wamp
    3. Point your browser at localhost http://localhost to see the default server configuration page. 
    4. Create a directory for the mikemoran website files c:\wamp\www\mikemoran
    5. Go to localhost to see that mikemoran is listed under “projects.” Then go to http://localhost/mikemoran
    6. Repeat the two steps above for biznolgy
  2. Install WordPress in each folder (repeat steps below for each website)
    1. Download the latest WordPress zip file, and extract it contents into the mikemoran subdirectory of www.  so that the wordpress files land in the mikemoran root.
    2. Visit http://localhost, then under Aliases,click on phpmyadmin to create a database. Use the same name as that on the production server.
    3. Visit http://localhost/mikemoran/wordpress to start the WordPress install. 
    4. When it says you have no config file, then click on the button that says “Create a configuration file.” You will be able to match it to the server later.
    5. When you get to the database screen, set the database name, set the MySQL username to root, and don’t set a password. Leave the other defaults. Click “submit.” Be careful about your database prefixes.
    6. Click “Run the install.” Put in the site title and the same wordpress usernames and password as that on the production server.
    7. Click “install wordpress”
    8. Go back to phpMyAdmin to check for the presence of your database tables
    9. Set PHP Config settings to be exactly what you have on the live production site (in php.ini). If you can’t see the contents of the php.ini file directly on the server, then you can run this php file:
      <?php&nbsp;phpinfo();&nbsp;?>

      Then navigate to that file in your web browser, and you will see the needed information. The instructions I found said that the most important thing is to make sure that safe_mode is set, and magic_quotes_gpc is set. I found them to be set to off on my live server, so I left them off in my WAMP installation. To compare it to the WAMP php, click on the WAMP icon, click on “localhost” and then click “phpinfo” which is under the Tools category.
    10. If you see from the php.ini file that you have a different PHP version on the live server than you do on WAMP, then change your wampserver PHP to match the one on the server, but at worst, it really ought to be at least PHP 5 on the server!  I left wampserver at 5.3.1.0, while my live site is 5.2.1.7 (for both site).
    11. To get pretty URL’s, enable mod_rewrite: click on the WampServer icon in the taskbar, mouse over Apache and then Apache modules. Find rewrite_module in the list and click it. You will need to then click Restart all services to start using mod_rewrite.
    12. Create a MySQL user with the same details as our live server’s WordPress MySQL user. To do this, browse to http://localhost/phpmyadmin again and click on your WordPress database to select it (you only have one database so this should be easy).Next, click on the Privileges tab at the top of the screen, and then click Add a new User. Give the new user the same name and password as your live MySQL user. Use localhost.   Click the Check All option at the bottom, which grants my new MySQL user all privileges. Click “go.”
    13. Configure the wordpress install: We will edit the WordPress config file (wp-config.php) to match the new database details.Configuring the WordPress Install to Match the Live ServerNow we have a local website that has the same configuration as your live server.
  3. Configure the wordpress admin pages. Open http://localhost/mikemoran/wordpress/wp-login.php. In settings–>general, change the URL’s to http://localhost/mikemoran.com. Scroll down all the settings in your wamp wordpress installation, and match them to the live server.
  4. Edit the apache config in WAMP to change the root pointer. There are two lines, one for root and one for directory.
  5. Install the latest version of techozoic
  6. Install all the plugins
  7. Copy the style file from the “custom css” plugin into the techozoic custom css.
  8. Create a zip file database backup from our current production site
  9. Backup the existing WAMP database
  10. Use importbuddy to import the backed up mikemoran database
  11. If there are errors, then remove the database and restore the backed up WAMP database. Then research how to pull in only the pages and posts.

NOW SANITY CHECK THAT YOU DID ALL OF THIS:

 Password Setup
1. Set a password for root/localhost in PHPMyAdmin
2. Added the following code (after the colon) right above the Servers configuration section in the config.inc.php file: $cfg['blowfish_secret'] = ”;
3. I entered a passphrase between the ” in the above added code.
4. Changed the auth_type = cookie (Actual code: $cfg['Servers'][$i]['auth_type'] = ‘cookie’
5. Entered my new root password in the Password line between ”
6. Exiting and Restarting WAMP
7. Successfully logged into phpMyAdmin using new root password

Setup new Database
1. Added new User
2. Set database name = new user name
2. Able to login w/ new user and can only access/use the one database.

WordPress Install
1. Downloaded and unzipped WordPress
2. Moved the contents of the wordpress folder over to c:\wamp\www\mikemoran (since I plan on seting up multiple WP sites, I assume this is where I’ll need a separate unique folder for each WP site)
3. I type in [localhost] and I receive the Create config file message.
4. Edited wp-config-sample.php w/ notepad++
5. Rename to wp-config.php
6. Set the Database, Username, and Password all equal to the names setup above which are all the same name. NOTE: This means I am entering the new user here, not the ROOT User correct?
7. Saved file
8. Refreshed browser — WordPress installation page opened
9. Set Site Title = Domain Name
10. Set Username and Password
11. Set email
12. Set to allow in search engines
13. SUCCESS
14. Successfully logged in as admin

AND FINALLY, do this:

The Virtual Hosts setup:

1. Created the folder “logs” under c:\wamp\www\mikemoran
2. Created the folder “logs” under c:\wamp\www\biznology
3. Created the Log file folders for both of the above
4. Removed # from Include conf/extra/httpd-vhosts.conf (line 466) in httpd.conf file
5. Added code to httpd-vhosts.conf file

NameVirtualHost *:80


ServerName mikemoran.com
DocumentRoot C:/wamp/www/mikemoran
ErrorLog “C:/wamp/www/mikemoran/logs/error.log”
CustomLog “C:/wamp/www/mikemoran/logs/access.log” common


ServerName biznology.com
DocumentRoot C:/wamp/www/biznology
ErrorLog “C:/wamp/www/biznology/logs/error.log”
CustomLog “C:/wamp/www/biznology/logs/access.log” common


ServerName localhost
DocumentRoot C:/wamp/www
ErrorLog “C:/wamp/www/logs/error.log”
CustomLog “C:/wamp/www/logs/access.log” common

6. Update hosts file

127.0.0.1 localhost
127.0.0.1 mikemoran (.com?)
127.0.0.1 biznology (.com?)

How to restore a WordPress website

 
After too much googling, I found a generous and bright gal who blogged about how to restore a WordPress web site. I suggest reading it and following her recommendations BEFORE the catastrophe, if possible.

Her name is Thu Nguyen, and this is the link to her post:

http://www.bloggingfor.info/how-to-restore-your-wordpress-site-in-less-than-1-hour

And because the thought of catastrophic loss strikes fear in the hearts of even the most rational, I am also copying her post here, just in case she takes down her site or something equally unlikely.

As a final note, I’ve given her all due credit. I’ve linked to her, friended her, and subscribed to her, and, in exchange, hope she understands that I’ve duplicated her words here for posterity. So here goes, with the content of
Thu Nguyen’s post about restoring a WordPress site:

I ran into a horrible dilemma yesterday and it would have cost this whole blog it’s life but luckily using a few tools, I had a backup of the database which helped me restored everything. Strangely, everyone always preaches backing up but don’t really explain how you can put it back up online.

So today’s article will explain what I did to restore this blog back to it’s original state with a couple of exceptions. You’re going to at least lose one article, some comments or the last tweaks from several hours ago. No biggie but yet, it still hurts. Hopefully, from this lesson alone, you’re backing up your site daily if not, twice as it begins to accumulate.

Without further ado, let’s carry on.

If you’ve accidentally uninstalled WordPress

Before you reinstall, make sure you go into your web hosting dashboard and back up everything you got under your site’s folder. You can do this with a FTP (file transfer protocol) program which your host suggests or use the browser version which they provided. This will allow you to click and drag over the content to your hard drive’s preferred path.

Why? If you’re going to reinstall, the new configurations won’t overwrite the old files. Your old files kept the configurations of your old blog. So you want to back up these files which has all the uploaded media you’ve been putting up for the past couple of months or more.

Depending on how old your site is, the wait can be about 5 minutes to half an hour. It took me about 10 minutes but once that is done you can then re-install WordPress onto your domain name using your web host 1-click install.

install the same version of wordpress you had before, not update it

If updating your WordPress version is something you want to do now, you may do so but I suggest not because if your site has been using an older version, configured for it, then you might be running into some errors, namely with plugins and theme integration. That’s going to mean more down time and a whole lot of technical tweaking.

Now you’ve got WordPress installed

You’ll notice that all your original posts are gone, even your site’s design is set to a template. Tear. Tear. I feel you. If you go on over to your plugins installation you’ll noticed that they’re still all there, just not activated. OK good.

Here are two of the most important plugins you’ll need to restore the site back with all your original articles and pages. Make sure you get the latest version which will be stable enough with your WordPress version!

Thanks to WP-DBmanager, I already had a backup of the database of the site on my web host server. However, here’s the sad part, it was backed up from the previous day. So the current post, if you have had one will be lost. Don’t worry I’ll show you how to back those up too if you so happen to get worried. But first, let’s carry on with restoring your database files.

Activate the plugin if you haven’t already done so. Head on down towards:

DatabaseManage Backup DB

Manage Database inside WP-DBmanager

You’re going to then get the latest databases you have on your server, now if you haven’t already installed a database backup plugin yet, now’s the time to do so! Don’t prolong backing up until it hits you, because when you get to this part, you’re going to be hit dead on. Let’s not make it happen.

Restore your database

Below you’ll notice I already had some past databases. This is helpful if you’ve upgraded your WordPress to a newer version and got errors and want to downgrade back. Restoring from your backup database will bring back the older version. Likewise, you want to choose the latest backup. In this case, you’ll see the newer version for today below but I had to opted for the July 19, 6:19 am file, which before the problem occurred was all I had.

Wp-DBmanager timeline table

Notice that the files are in SQL, an extension for the common database language file in the structured query language system. You have the option to compress these files into a GZip file but because you don’t have to. Here it’s saved in it’s entirety on my web hosting server. If you want to compress yours you can do so. We’ll get to that in a moment.

Now, choose the data you want restored, the e-mail you want the backup file sent to and click on RESTORE. Give it a couple of moments and then continue on.

You’ve restored the backup database, now what?

Check your site to see if all your original posts and pages are back. You’ll notice that there’s a slight change in your theme. But that’s OK, the point is are the pages there? Click on a link and test it out. You’ll notice that you’ll get a 404 error.

OK, now’s the time to repair your database and optimize it as well. Doing both will sync your site with the restored pages so that search engines will look for the pointers you’ve restored. Thus, it won’t produce those 404 errors that will become frighteningly scary.

WP-DBmanager repair

All you have to do is select YES to all the options and click on REPAIR. It might take a minute so be patient. Next, on top of the Repair DB option is Optimize DB. Just like repairing, you just select all the options and click on OPTIMIZE.

You’ll notice that it’s suggested to optimize your database each month. It won’t hurt to do it weekly though. Helps your site load faster and also your content organized.

From this point, you want to activate or install WP Super Cache or your preferred caching plugin. Once you’ve done so, delete the cache. This will refresh your site and actually let you see everything restored from the database backup. Click on the links and pages you got. Are they there? Are you still getting 404 errors?

Go back and repeat the process from restoration again. See if that will help.

Some minor disappointments worth changing

You’re not going to be entirely satisfied with the backup. At least I wasn’t because I still lost a post, some comments and also the theme was out of sync. In order to save myself from those miseries for the future, I did a backup and configuration of several more areas:

  • Thesis’s configurations
    • ThesisManage OptionsDownload OptionsAll Options
    • This will export a .dat file with the current date, great for organizing
  • exported WordPress content
    • ToolsExportDownload Export File
    • This will export a .xml file with all your wordpress content also with current date
  • changed the schedule of database backups to a shorter timeframe
    • DatabaseDB Options
    • Take a look at this section CAREFULLY because this will enable you to have more or less backups. You can set the maximum backup files – default is 10. Then under Automatic Scheduling, set when you want to backup and when you want to optimize. Here’s where you can set if you want your files saved as a compressed GZip or not. Then save your changes and you’re all set.

While I was on the brink of giving up in looking for that last post, I forgot, I also had a subscription to my RSS feed. Thankfully, that saved me because it syndicated the latest content and I had it in my e-mail box. So subscribe to your own feed if you haven’t already done so. It’s good recordkeeping plus a great place to restore content if all else fails.

What happened was TweetMeme also referenced to this post in a certain link. All I did was:

  • repost the content
  • set it to the correct date
  • set the permalinks correctly

This put me back in business and while it was a bucket of sweat, it was worth shedding!

Worst Case Scenario

Downtime is something you don’t want from your blog. One of the tools which will help you monitor your downtime is UpTimeRobot. Not only that, it will also let you know when your site goes back up.

uptime robot logoI’ve been using it for the past couple of weeks and am surprise with the results it has given me. I’m learning more about my web host’s ability to serve me better and times which I should be aware of. The usability is really straight-forward. So it’s an analytic tool which you should keep handy to track your site’s downtime.

Best of all it’s FREE.

Another thing is ranking. Who knows how much visitors I’ve lost or even comments which are bringing in link juice. While those are just some possibilities. Losing your work is something you don’t want happen. So while the longer your site is offline, the rankings will fall off too.

Thus, I was lucky. Very lucky to have backups of the content and also approached the situation as promptly as I could.

Yours could be a matter of more difficulty. If so, ask your web host provider to do the technical stuff for you. Call them to back up what they can of your site from their backups. Don’t be happy yet, some might have it a week prior so you’re still going to miss out at least some posts, comments or changes.

Look on the bright side, better to have most of it than none.

I hope this article will help you ensure the future of your site as well as save you from any loss in profits, mental misery or even ongoing efforts.

Any other suggestions for backing up? What’s your backup nightmare story?

 

Drupal 7 Create a sub-theme based on Bartik

I have copied this great information from opensourcecms.pro

Assume you want to customize the default Bartik theme bundled with Drupal 7. Since you know it is a bad idea to alter the core files, you are going to create a new sub-theme based on Bartik and make your modifications there.
Step 1: Create a copy
First, copy the directory /themes/bartik
Step 2: Rename the directory
Paste the base theme directory into the directory /sites/all/themes and rename it as you see fit. For purposes of our example, we’ll call it newsub. In other words, you should now have a complete set of themes files located at /sites/all/themes/newsub
Step 3: Delete unwanted files
The sub-theme will inherit almost everything from the base theme. (The exceptions are the .info file and the site logo image file.) Given that inheritance is the norm, you should eliminate everything from the sub-theme that you don’t plan to change. In other words, if you don’t plan to modify a particular file, delete it from the sub-theme’s directory.
Most people will want to consider keeping one or more of the templates and the template.php file, but this depends on your plans. If you intend to customize any of the existing templates, or create template suggestions, keep the relevant templates. If you want to modify any of the themable functions or create new ones, you will need the template.php file.
Open up your newsub directory and delete everything you don’t need. No matter what you plan to do, you should keep the .info file — your sub-theme has to have a .info file — and keep the /css and /templates directory, though you can delete the contents if you don’t plan to modify them.
Step 4: Update the theme name throughout
Next, let’s update the theme name inside all the files we’ve kept. We need to change every occurrence of “bartik” to “newsub.” If you’ve got a code editor, you can run a find/replace to get this done, if not, you’ll need to crack open each file and do this.
Step 5: Create your stylesheet
Next, let’s create a new .css file. This is a requirement for a valid sub-theme; you need at least one stylesheet. Create an empty file, name it newsub.css and put it in the /css directory.
Step 6: Update .info
Make sure your .info is now called newsub.info. Next, open up the file and perform the following operations on the contents:
1. Make sure the name field has been updated to reflect the name of the sub-theme.
2. Update the description line as you see fit – this information will appear inside the Theme Manager as a description for the theme.
3. Delete the lines for package and version.
4. Add a new line: base theme = bartik
5. Declare our new stylesheet by adding this line: stylesheets[all][] = css/newsub.css
6. Delete all other stylesheet declarations.
7. Save the file.
Note that sub-themes do not inherit custom regions from the parent theme. Therefore if you want to use any custom regions in the base theme, you will need to re-specify them in the sub-theme’s .info file. In the example we’ve just worked through, we’ve simply copied the Bartik .info file, so we already have the entire list of custom regions in the newsub.info file.
That’s all there is to it! At this stage you have a new, fully functional theme. If all has gone according to plan, your NewSub theme can now been seen inside the Disabled Themes section of your site’s Theme Manager.
Additional Tips – Overriding Templates
• If you wish to modify any of the templates included in the Bartik base theme, simply copy them over to your directory /newsub/templates and make your changes
• If you want to override other core templates, copy the original template and place it in /newsub/templates
• If you want to add a template suggestion, place the base template in /newsub/templates and create your new suggestion in the same directory
Additional Tips – Overriding Styles
• If you want to override a specific style, simply place the selector in /css/newsub.css
• If you want to override an entire stylesheet from the base theme, place a file of the same name in the /newsub/css directory.
Additional Tips – Overriding functions
• If you want to override an existing function, copy it into /newsub/template.php and change the name to match your new sub-theme.
Where to go to Learn More
• Sub-theme strcture and inheritance, http://drupal.org/node/225125 (note this has yet to be updated for Drupal 7, but is valid)
• Structure of the .info file, http://drupal.org/node/171205
• Overriding themable output, http://drupal.org/node/341628 (note this has yet to be updated for Drupal 7, but is valid)
• Using Base Themes, http://drupal.org/node/980434

Drupal 7 multisite step by step tutorial

I had a first site called FIRSTSITE.com.
I wanted to add another site called SECONDSITE.com.
I wanted the second site to render as a separate website, and I wanted the two sites to share my Drupal 7 installation.

I couldn’t find a guide for Drupal 7 multisite, so now that I’ve figured it out from a pastiche of advice, I’m documenting it.

This post is not about updating a multisite from Drupal 6 to Drupal 7. I am a Drupal noob with Drupal 7. It assumes Lunarpages VPS Hosting but that may not matter.

  1. Install Drupal 7 for FIRSTSITE.com. (I had already done that earlier.)
  2. Create a new MySQL database and user. They will be used for the new site SECONDSITE.com.
  3. Configure SECONDSITE.com to point to the FIRSTSITE.com servers. In my case, I did that with Network Solutions, and I documented it here The change can take a day or two to complete.
  4. Park SECONDSITE.com to FIRSTSITE.com. How to do it in Cpanel is here. I did it in LPCP (a control panel available when you have Lunarpages hosting.)
  5. Create a directory /sites/SECONDSITE.com/ inside your main Drupal folder.
  6. Copy the default.settings.php file (found in drupal/sites/default/) to /sites/SECONDSITE.com/ and rename it to settings.php
  7. Change its permissions to 666 (make it changeable by everyone)
  8. Make a new directory under /drupal/sites/SECONDSITE.com/ and name it “files”, then change permissions of it to 777.
  9. Navigate to http://SECONDSITE.com/install.php, and complete a new installation for SECONDSITE.com with the Mysql details from earlier.

Reference:
# cp drupal/sites/default/default.settings.php drupal/sites/SECONDSITE.php
# chmod 666 drupal/sites/SECONDSITE.com/settings.php
# mkdir drupal/sites/SECONDSITE.com/files
# chmod 777 drupal/sites/SECONDSITE.com/files

How to FTP in SSH

This post is my own procedure for transferring files from one server to another using SSH so that I don’t have to download, and then upload again. (I used mput)

I’m sure there’s an easier way to do this, but I’m an SSH noob, so I worked out a procedure like a monkey with a typewriter, and it works, so there you go.

Background:

I can back up to three places. The first is on the existing server. That’s simply done from LPCP. But that is vulnerable if the server crashes. I can also then download to my hard drive. Thirdly, I can move the backup to the 1GB extra space given to me by lunarpages. That can only be accessed by FTP, and not by HTTP.

The server is MYEXTRASERVER.com

However, as the site grows, the downloads and uploads will take a long time. So instead I can get into my VPS by way of SSH using Putty, and then establish an ftp session to get to MYEXTRASERVER.

Here is the procedure that Lunarpages gave me (with a few enhancements from me):

  1. get into the current directory of local where the files are that I want to move
  2. ftp host_name
  3. you will be asked for user and password
  4. use ls command to see list of files
  5. get into the directory where I want to move to
  6. put command to upload a file (put local-file [remote-file ])
  7. get to download a file

Here’s some excerpts from an actuall SSH session in which I followed the procedure. The purpose of this session in SSH is to get into MYMAINSERVER.com and then ftp to my backup location at MYEXTRASERVER.com

Run putty to open an SSH session in MYMAINSERVER.com

cd public_html
cd lm_backup_migrate
cd backup_migrate
cd manual
ftp MYEXTRASERVER.com
ftp> cd LINDABACKUPS
ftp> cd lm_backup_migrate_module
ftp> cd manual
ftp> mput *
y
y

This is where I hit break to disconnect from MYEXTRASERVER.com

cd ..
cd scheduled
ftp MYEXTRASERVER.com
ftp> cd LINDABACKUPS
ftp> cd lm_backup_migrate_module
ftp> cd scheduled
ftp> mput *
y
y
y
y
y
ftp>

Drupal 7 How to replace a module with dependencies

Today I had to replace ctools, as I was using an alpha version that was generating ajax errors. Instead I wanted the more stable dev module.

But I found the task a bit daunting, as ctools has many dependencies. Happily I found some instruction, which of course can be applied to other modules as well:

  1. REMOVE the ctools folder from sites/all/modules. Keep a copy. (What I did was move it up a directory.)
  2. Go to Drupal admin/modules and DISABLE every contributed module. DO NOT UNINSTALL.
  3. REPLACE the ctools folder on the server. (Unzip on my hard drive, then upload to sites/all/modules.)
  4. Go to Drupal admin/modules. Hopefully it will now display, since you’ve removed the overhead of other modules. ENABLE each of the modules you disabled in step 2.
  5. Remove the old ctools folder that you moved up a directory.
  6. Run the Drupal update script
  7. Run Drupal Reports to make sure all is well.

Lunarpages how to get to the apf config file

Edit the apf config file

APF is the firewall given to VPS customers with “Managed Hosting Intense.”

  1. Get into the root (su -)
  2. cd /etc/apf
  3. nano conf.apf

Use the firewall

Code:
Usage /usr/local/sbin/apf [OPTION]

OPTIONS are as below

-s|–start ……………………. load firewall policies
-r|–restart ………………….. flush & load firewall
-f|–flush|–stop ……………… flush firewall
-l|–list …………………….. list chain rules
-st|–status ………………….. firewall status
-a HOST CMT|–allow HOST COMMENT … add host (IP/FQDN) to allow_hosts.rules and immediately load new rule into firewall
-d HOST CMT|–deny HOST COMMENT …. add host (IP/FQDN) to deny_hosts.rules and
immediately load new rule into firewall

As an example, if you would like to deny an IP from accessing your sites, execute,

apf -d 123.123.123.123


Installation Details

Install path: /etc/apf/
Config path: /etc/apf/conf.apf
Executable path: /usr/local/sbin/apf
AntiDos install path: /etc/apf/ad/
AntiDos config path: /etc/apf/ad/conf.antidos
DShield Client Parser: /etc/apf/extras/dshield/

Solved — Clean URL’s in Drupal 7 on Lunarpages VPS

The Problem

I have a new hosting account which is Xen Cloud VPS on Lunarpages. (Cloud Hosting is considered by Lunarpages to be a type of VPS hosting.)

I have a new installation of Drupal 7 on this VPS hosting setup, and couldn’t get Clean URL’s working.

Specifically, the problem was that Clean URL’s had no checkbox in Drupal 7. I learned from the drupal.org forums that “no checkie, no cleanie” but none of the solutions offered worked for me.

What I tried but no joy

1. Made sure that I had copied over Drupal’s default .htaccess
2. Made sure that my host company, Lunarpages, had mod_rewrite enabled
3. Tried updating my apache config file (httpd.conf), but I didn’t really know how to do it

My suspicion

Then I started to suspect that my .htaccess file was being ignored, so I put a 301 redirect in it to test it. Lo and behold, my .htaccess file was not being used. There was no redirect.

Then I opened a ticket with Lunarpages

My ticket said, “Do I need to configure something in the apache config file? I already tried AllowOverride All in the config file, but I may not have done it correctly–it didn’t work. So I restored the original config file. (The htaccess is for Drupal. It is supposed to allow me to get “clean urls” using mod_rewrite, but I think I’m overlooking something.)”

The solution

Lunarpages found the problem and fixed it. The tech at Lunarpages said this “AllowOverride All was missing from your VirtualHost, however this option should be placed between directives. As such httpd.conf and .htaccess has been updated, and the 301 Redirect is working as expected.”