I'm facing issues with a website that i'm attempting to deploy. The website is working fine on my small development host, but fails on deployment. Both hosts possess a similar configuration, both of them are Ubuntu Linux distros (dev: 11.10, deploy: 10.04), both use apache2, etc.

Both sites have mod_dir enabled, however the deployment one appears to not add the trailing slash to directory names, as the development you do. So, after i enter this URL (removed http to prevent silly stackoverflow antispam blocking):

devel.mydomain.com/admin

The expansion host redirects it to:

devel.mydomain.com/admin/

In deployment http://mydomain.com/admin isn't rerouted to mydomain.com/admin/ for unknown reasons, and that i finish having a 404 error. Obviously basically enter mydomain.com/admin/, adding the trailing slash manually, it really works not surprisingly. However I rather prefer to redirect also mydomain.com/admin to mydomain.com/admin/

Now you ask , WHY in devel mod_dir appears to do the redirection as well as in deployment it doesn't.

I've done a grep within configuration files to ascertain if the DirectorySlash directive had been disabled somewhere and located nothing. It's neither enabled clearly on devel, so It ought to be on automatically. Anyway I add this to my .htaccess file on deployment host:

DirectorySlash on

But it didn't work neither.

Any hints?

The /admin folder is password protected. I didn't believe that it was relevant, but and it's also.

Also I've these rules on my small .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
    </IfModule>

The issue is associated with this - see here for any good explanation.

Essentially, when Apache creates a 401 error to request the browser for any password, additionally, it creates another request that doesn't use any folder, directory, or symlink, so it's rerouted to index.php.

The workaround would be to add this towards the .htaccess file on-site root folder:

ErrorDocument 401 /error/null.html
ErrorDocument 403 /error/null.html

and make that file, for instance such as this:

touch ./error/null.html

These aren't guidelines but they'll do for the time being as i search for a much better solution.