1

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?

2
  • 2
    Is it redirecting to that or is that directory configured to return default.asp as its default document (DirectoryIndex)
    – uSlackr
    May 25, 2012 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
    May 26, 2012 at 1:10

1 Answer 1

1

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
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .