Apps in /var/www/html 404 error

luschache

Verified User
Joined
Mar 1, 2012
Messages
24
After upgrading to Custombuild 2.0 my apps like PHPMyAdmin and roundcube cannot be found anymore (404). My options.conf contains:

Code:
use_hostname_for_alias=yes
redirect_host=secure.host.com
redirect_host_https=yes

My conf/extra/httpd-alias.conf is:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/config/ [OR]
RewriteCond %{REQUEST_URI} ^/config$ [OR]
RewriteRule ^/config(.*) https://secure.host.com/redirect.php$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/roundcube/ [OR]
RewriteCond %{REQUEST_URI} ^/roundcube$ [OR]
RewriteRule ^/roundcube(.*) https://secure.host.com/roundcube$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/webmail/ [OR]
RewriteCond %{REQUEST_URI} ^/webmail$ [OR]
RewriteRule ^/webmail(.*) https://secure.host.com/squirrelmail$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/phpMyAdmin/ [OR]
RewriteCond %{REQUEST_URI} ^/phpMyAdmin$ [OR]
RewriteRule ^/phpMyAdmin(.*) https://secure.host.com/phpMyAdmin$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/phpmyadmin/ [OR]
RewriteCond %{REQUEST_URI} ^/phpmyadmin$ [OR]
RewriteRule ^/phpmyadmin(.*) https://secure.host.com/phpMyAdmin$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/pma/ [OR]
RewriteCond %{REQUEST_URI} ^/pma$ [OR]
RewriteRule ^/pma(.*) https://secure.host.com/phpMyAdmin$1

Though, to get is work, it should be:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/config/ [OR]
RewriteCond %{REQUEST_URI} ^/config$ [OR]
RewriteRule ^/config(.*) https://secure.host.com/redirect.php$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/roundcube/ [OR]
RewriteCond %{REQUEST_URI} ^/roundcube$ [OR]
RewriteRule ^/roundcube(.*) https://secure.host.com/roundcube$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/webmail/ [OR]
RewriteCond %{REQUEST_URI} ^/webmail$ [OR]
RewriteRule ^/webmail(.*) https://secure.host.com/webmail$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/phpMyAdmin/ [OR]
RewriteCond %{REQUEST_URI} ^/phpMyAdmin$ [OR]
RewriteRule ^/phpMyAdmin(.*) https://secure.host.com/phpMyAdmin$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/phpmyadmin/ [OR]
RewriteCond %{REQUEST_URI} ^/phpmyadmin$ [OR]
RewriteRule ^/phpmyadmin(.*) https://secure.host.com/phpMyAdmin$1

RewriteCond %{HTTP_HOST} !^secure.host.com$
RewriteCond %{REQUEST_URI} ^/pma/ [OR]
RewriteCond %{REQUEST_URI} ^/pma$ [OR]
RewriteRule ^/pma(.*) https://secure.host.com/phpMyAdmin$1

Alias /config "/var/www/html/redirect.php"
Alias /phpMyAdmin "/var/www/html/phpMyAdmin/"
Alias /phpmyadmin "/var/www/html/phpMyAdmin/"
Alias /pma "/var/www/html/phpMyAdmin/"
Alias /squirrelmail "/var/www/html/squirrelmail/"
Alias /roundcube "/var/www/html/roundcube/"
Alias /webmail "/var/www/html/roundcube/"

I copied this file to /usr/local/directadmin/custombuild/custom/ap2/conf/extra/httpd-alias.conf, but after I rewrite my config files, it still gets overwritten. How can I retain my httpd-alias.conf file when rewriting the configfiles?
 
It is not a bug, redirect_host must be a hostname to work. About custom/ap2/conf/extra/httpd-alias.conf - yes, it was a bug, which is now fixed. You can now use this file in custom/ directory, thank you for reporting the issue.
 
My redirect_host IS a hostname, I just did not want to give my real host name away in the forum. Also I never mentioned custom/ap2/conf/extra/httpd-alias.conf, I do not have a custom directory for this. Please read my reply 31 here http://forum.directadmin.com/showthread.php?t=46187&page=2&p=238343#post238343 (Edit: I see your reply was for user luschache, but please read my reply in the link, I hope what I describe there will be fixed soon. Thanks.)
 
Last edited:
It is not a bug, redirect_host must be a hostname to work. About custom/ap2/conf/extra/httpd-alias.conf - yes, it was a bug, which is now fixed. You can now use this file in custom/ directory, thank you for reporting the issue.

Thank you, it seems to work almost fine now. Just one small problem:

Code:
Alias /webmail "/var/www/html/squirrelmail/"

It would be nice to change it to:

Code:
Alias /webmail "/var/www/html/webmail/"

That way, you can use a symlink to set your default webmail. For example, I (and I think many with me) prefer Roundcube above Squirrelmail.
 
I had the same issue on Debian 7, two alias were missing and the redirections didn't work to squirrelmail & roundcube.
I have followed copied the httpd-alias.conf and then avoid this configuration file to be overwritten during updates i have done:

Code:
chattr +i /etc/httpd/conf/extra/httpd-alias.conf

then i have reloaded apache config with a httpd reload
 
Back
Top