Wednesday, January 18, 2012

How to Check if mod_rewrite is working for my site and on Server- .htaccess works

If you suspect mod_rewrite may not be working on your site, one simple method to verify is to setup a single redirect to test it.

Add the following line to the top of your .htaccess file:

Code:
 RewriteEngine on RewriteRule testpage\.html http://www.google.com [R]
Then re-upload it to your server.

Once the .htaccess file has been updated, enter the following into your browser:

This should automatically redirect you to Google.

If this works, then mod_rewrite IS working on your server.

If this does NOT work, then mod_rewrite is either disabled or setup incorrect. Contact the vBSEO Total Support Team via a the ticketing system:
http://www.vbseo.com/tickets/





way -2


How to Check if mod_rewrite is Enabled on your Server

Here's a tip I thought I would share. Many of the open source applications that are currently available rely on an Apache module called mod_rewrite to rewrite requested URL's on the fly. Applications such as Mambo rely on mod_rewrite being present and enabled on a server in order to produce Search Engine Friendly URL's.
Here is a way to check if mod_rewrite is enabled on your server...
  • Create a file called .htaccess (note there is nothing before the file extension).
  • Put only these two lines in your .htaccess file.
    Options +FollowSymLinks
      Redirect /google.html http://www.google.com
  • Upload this file to your site root on your server.
  • Now point your browser to: http://www.example.com/google.html (replacing example.com with the domain name of your own website).
If you are redirected to Google, mod_rewrite is working.
If you get an error, then mod_rewrite is not working.
If mod_rewrite is not working, check Apache configuration.

Apache requirements for mod_rewrite

The Apache httpd.conf file has the settings to enable URL rewriting.
Two settings are required.
  • mod_rewrite module is installed
    Search file for LoadModule rewrite_module and un-comment that line (remove the leading #)
  • AllowOverride All
    Search file for AllowOverride None and change it to AllowOverride All
Restart Apache
Restarting the Apache web server is required for the changes to take effect.
NOTE: If you are testing whether mod_rewrite is enabled for your Mambo Open Source website, you need to follow these steps:
  • Rename your htaccess.txt to .htaccess, or use your existing .htaccess file.
  • Enable SEF URL's in your administrator backend
  • Place the following lines in your .htaccess file.
    Options +FollowSymLinks
      Redirect /google.html http://www.google.com
  • If your site is located in a sub-domain, eg. "test", you need to include the subdomain in the path, like this for example:
    Options +FollowSymLinks
      Redirect /test/google.html http://www.google.com
  • Point your browser to: http://www.example.com/google.html or http://www.example.com/subdomain/google.html (replacing example.com with the domain name of your own website and subdomain - if applicable- with your subdomain name).
If you are redirected to Google, mod_rewrite is working.
If you get an error, then mod_rewrite is not working.