when i try to access website without www. i get access denied.
Posted
by
madphp
on Server Fault
See other posts from Server Fault
or by madphp
Published on 2011-01-13T07:18:38Z
Indexed on
2011/01/13
7:55 UTC
Read the original article
Hit count: 389
I have an apache web server on a debian machine. Im using virtualmin to administer virtual hosts. I have two sites on this server right now, when i try to access one site without the www in the URL i get an access denied. The other site is fine. The site with the problem is a cakephp app and has the following .htaccess file in the public_html folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Below is the directives for the problem domain.
SuexecUserGroup "#1001" "#1001"
ServerName mydomain.net
ServerAlias www.mydomain.net
ServerAlias webmail.mydomain.net
ServerAlias admin.mydomain.net
DocumentRoot /home/mydomain/public_html
ErrorLog /var/log/virtualmin/mydomain.net_error_log
CustomLog /var/log/virtualmin/mydomain.net_access_log combined
ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/
ScriptAlias /awstats/ /home/mydomain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/mydomain/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/mydomain/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mydomain.net
RewriteRule ^(.*) https://mydomain.net:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mydomain.net
RewriteRule ^(.*) https://mydomain.net:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
<Files awstats.pl>
AuthName "mydomain.net statistics"
AuthType Basic
AuthUserFile /home/mydomain/.awstats-htpasswd
require valid-user
</Files>
© Server Fault or respective owner