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.

This is the content of my .htaccess file:

Options MultiViews
Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC]
RewriteRule ^(.*)$ http://lventas.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA]

ErrorDocument 404 http://www.lventas.com/404.php
RewriteOptions Inherit

It isn't supposed to do nothing when going to the root folder but it's still redirecting to:

http://lventas.com/negocio/default.asp

What is 'default.asp'?? and why is directing there?

share|improve this question
2  
Is it redirecting to that or is that directory configured to return default.asp as its default document (DirectoryIndex) –  uSlackr May 25 '12 at 21:17
    
default.asp is a file associated with microsoft active server pages, hence its likely there is some existing configurations interfering. You can paste the output of apachectl -S for a list of all the vhosts configured. –  Tom H May 26 '12 at 1:10

1 Answer 1

up vote 1 down vote accepted

As @uSlackr mentioned in the comment, one of the parent configurations likely contains a directive like so;

 DirectoryIndex default.asp

The DirectoryIndex directive provides a default resource for when the client requests a directory i.e. http://www.lventas.com/ hence the request is mapped to the filesystem relative to the DocumentRoot as REQUEST_FILENAME=/default.asp

However, as default.asp does not exist as a file, a directory or a link, it then matches your second RewriteRule like so;

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA]

so the final request is http://lventas.com/negocio/default.asp

You can usually override this like so;

DirectoryIndex index.php

Options MultiViews
Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC]
RewriteRule ^(.*)$ http://lventas.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA]

ErrorDocument 404 http://www.lventas.com/404.php
RewriteOptions Inherit

or it seems like it might be possible to just unset the DirectoryIndex like so;

DirectoryIndex

Options MultiViews
...
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.