Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My .htaccess file is in the root directory of my website, and I narrowed down a problem to the single line of code 'RewriteEngine on'. How do I know it's this piece of code? Because I deleted the entire .htaccess file except for 'RewriteEngine on' as a test...and my CGI application still broke.

If anyone has any idea why the 'RewriteEngine on' line decides to break the CGI application all on it's own I'd love to hear it! Thanks,

-Karl

PS - Just in case you're interested, the piece of code that I want to get working is to help consolidate all domains into a single domain (the line breaks are there simply to make it easier to read):

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mastercontrols.com$ [NC]

RewriteRule ^(.*)$ http://www.mastercontrols.com/$1 [L,R=301]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html

RewriteRule (.*) http://www.mastercontrols.com/ [R=301,L]

share|improve this question

migrated from stackoverflow.com Dec 23 '09 at 3:56

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Chances are that mod_rewrite is not currently enabled in your Apache configuration (usually in httpd.conf).

If it is enabled, it would look something like this:

# For Unix-like OSes
LoadModule rewrite_module modules/mod_rewrite.so

or

# For Windows
LoadModule rewrite_module modules/mod_rewrite.dll

as well as

# For both
AddModule mod_rewrite.c

The AddModule line may not be necessary in Apache 2.0/2.2.

Some OSes place Apache module loaders in another directory. On Debian and Ubuntu Linuxes, configuration files for installed modules are in /etc/apache2/modules-available, and can be activated with a2enmod modulename; in this case a2enmod rewrite.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.