Search Engine Friendly Redirects Using Apache

HTTP Status code 301 is a server response for a page that has been moved permanently. If you have a primary domain with one domain extension, such as, and several secondary domains with different extensions, such as and, that you want to wind up at the primary domain use the 301 server response. This will let search engines know about your primary domain. The 302 responses can adversely affect your search engine rankings. Your domain registrar may be able to take care of these redirects for you.

Apache can also take care of redirects. Have the secondary domains resolve to where the apache server is running, and set up a virtual server to handle the redirects. The configuration could look something like this:

<VirtualHost *>

<VirtualHost *>
 ServerName redir_foo_domains
 ServerAlias * *
 Redirect 301 /

Check the server headers to verify that your secondary domains are redirecting correctly. There are a few sites that can do this for you, such as

Upgrading Instant Rails 2 to use PHP5

This may also work for upgrading earlier versions of Instant Rails to PHP5. There was a guide online I used last time, but I can’t seem to find it. Back up your current Instant Rails directory before upgrading, in case something goes horribly wrong. SVN, Git, or some other version managment system is good as you can go back later and look at what you did to upgrade, and what files actually changed. But backing up is important, even if its just copying and pasting the entire Instant Rails folder.

Here is a run down of what I did this time:

Get PHP5

  1. Get a copy of PHP5. Just get the zipped folder, using the installer isn’t really necessary and makes the process more mysterious than it should be.
  2. Make a new folder called php4 in the InstantRails directory (or wherever your php folder lives), and copy the contents of the php folder to php4. This will make backing php5 out easier should you find it necessary.
  3. Extract your copy of PHP5 to the php folder

Modify Configuration Files

  1. In the php folder there will be two configuration files of interest. “php.ini-dist” and “php.ini-recommended”. Take a look at them and decide which you want to use. “php.ini-dist” has a warning at the top regarding its intention, ie its suitable for development, but probably the best idea for use in production. Copy these to the “InstantRails/conf_files”, rename the existing php.ini to php.ini.old, and rename the config file you want to use to “php.ini”.
  2. Backup and then modify “conf_files/httpd.conf”. The basic changes will be:

Replace: LoadModule php4_module "${path}/php/php4apache.dll"
With: LoadModule php5_module "${path}/php/php5apache.dll"
Replace: AddModule mod_php4.c
With:  AddModule mod_php5.c

Check The PHP Version

  1. In your public web folder (InstantRails/www) create a file with a .php extension (ie, “version.php”) and put the following code inside:
    <?php phpinfo(); ?>
  2. Fire up InstantRails, and check that file from a browser. Depending on your setup and what you named the file, it should be at http://localhost/version.php. If everything went ok, you should see a page with info about your system. If you see “PHP Version 5.*” near the top (or something similar; you don’t want to see PHP Version, then it worked. Get rid of the version.php file, or change the extension to keep the whole world from seeing that page and your config info.