I'm using the current virtual host:

<VirtualHost *:80>
    ServerAdmin webmaster@mysite
    ServerName example.co.uk
    ServerAlias www.example.co.uk
    DocumentRoot /home/example.co.uk/htdocs/
    <Directory /home/example.co.uk/htdocs/>
            Options -Indexes FollowSymlinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    ErrorLog ${APACHE_LOG_DIR}/example.co.uk/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/example.co.uk/access.log combined

Within the .htaccess in the root I'm using RewriteRule ^enquiries$ /enquiries.php amoung several other redirects.

Somehow I have also a directory named "enquiries" (/home/example.co.uk/htdocs/enquiries/), and when I hit the URL www.example.co.uk/enquiries I get:

HTTP/1.1 301 Moved Permanently
Date: Mon, 10 Dec 2012 18:53:37 GMT
Server: Apache/2.2.16 (Debian)
Location: http://www.mysite.co.uk/enquiries/
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1

Any browser would also display the directories content. I could easily rename the folder and get it sorted, but I would like to understand what's going on here. What would be the correct way to configure Apache in a way that it wont behave this way?

If I did not explain myself clearly, please feel free to ask more questions, I'd be happy to answer them. Thanks!

  • Are you saying that you cannot view the folders contents because the rewrite is catching the word enquiries and creating an endless loop? – Anagio Dec 10 '12 at 22:57
  • No, I am saying I cannot redirect from a path that has the same name of a directory. No loops happens, I just see the content of the directory instead of seeing the correct file that apache should redirect to – milo5b Dec 11 '12 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.