Author |
|
veretekk
Joined: 23 Nov 2011 Posts: 3 Location: Wyoming
|
Posted: Wed 23 Nov '11 5:05 Post subject: error handling and bad subdomain redirect to main domain |
|
|
Can't make good subdomain bad file display error page. Bad subdomain defaults to root as it should. Badfile name on root domain displays error docs as it should. But, cant get good subdomain with bad file doc to work. It should stay on good subdomain and display error doc for bad file name.
Bad subdomain goes to root domain
http://badsub.xelr8-it.com/ WORKS
Good Subdomain
http://trivita.xelr8-it.com/ WORKS
Bad file error doc
http://www.xelr8-it.com/badfile.html WORKS
Good Subdomain with bad file
http://trivita.xelr8-it.com/basfile.html DOES NOT WORK It defaults to root domain.
Any tips, questions, suggestions would be greatly appreciated.
Tom |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 23 Nov '11 5:43 Post subject: |
|
|
well, without any more info than this, you're guess is as good as the rest of ours. error log may give a clue, one never knows. vhosts and how your error docs are setup would be helpful |
|
Back to top |
|
mantonik
Joined: 23 Nov 2011 Posts: 3
|
Posted: Wed 23 Nov '11 7:28 Post subject: Server setting |
|
|
Hi.
Here is apache configuration for this domain
when I try access http://trivita.xelr8-it.com/hhhh it generate 404 error as page not found and redirect it to main domain.
We want to display local 404.html error page
http://trivita.xelr8-it.com/404.html
and browser should display http://trivita.xelr8-it.com/hhhh in address bar.
Error log:
Code: |
[Tue Nov 22 22:26:12 2011] [error] [client 69.142.99.155] File does not exist: /data/apache/xelr8-it.com/htdocs/office/sub/trivita/hhhh
|
Code: |
<VirtualHost *:80>
# Main domain
ServerName xelr8-it.com
ServerAlias www.xelr8-it.com
ServerAdmin webmaster@xelr8-it.com
RewriteEngine On
VirtualDocumentRoot /data/apache/xelr8-it.com/htdocs
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 408 /408.html
ErrorDocument 500 /500.html
<Directory /data/apache/xelr8-it.com/htdocs>
Options All -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /data/apache/xelr8-it.com/htdocs/cgi-local
<Directory "/data/apache/xelr8-it.com/htdocs/cgi-local">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
Options ExecCGI
SetHandler cgi-script
</Directory>
ErrorLog /data/apache/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /data/apache/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:80>
#All subdomains
Options All -Indexes +Includes
ServerAlias *.xelr8-it.com
VirtualDocumentRoot /data/apache/xelr8-it.com/htdocs/office/sub/%-3
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
# Error is display corectly when path is specified to folder trivita
# <Directory /data/apache/xelr8-it.com/htdocs/office/sub/trivita >
# Error is not display when directory are define line that
#<Directory /data/apache/xelr8-it.com/htdocs/office/sub/%-3 >
# ErrorDocument 404 /404.html
#</Directory>
<Directory /data/apache/xelr8-it.com/htdocs/office/sub>
ErrorDocument 404 http://xelr8-it.com/
#ErrorDocument 404 /404.html
</Directory>
ScriptAlias /cgi-bin/ /data/apache/xelr8-it.com/htdocs/cgi-local
<Directory "/data/apache/xelr8-it.com/htdocs/cgi-local">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
Options ExecCGI
SetHandler cgi-script
</Directory>
CustomLog /data/apache/log/apache2/access.log combined
ErrorLog /data/apache/log/apache2/error.log
LogLevel warn
XBitHack on
</VirtualHost>
|
Thank you for sugestions.
Mariusz |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Wed 23 Nov '11 11:08 Post subject: |
|
|
This line causes it
Code: |
ErrorDocument 404 http://xelr8-it.com/
|
|
|
Back to top |
|
mantonik
Joined: 23 Nov 2011 Posts: 3
|
Posted: Wed 23 Nov '11 16:26 Post subject: |
|
|
Hi
I update config, I commit that line
http://trivita.xelr8-it.com/test.html - is working
http://trivita.xelr8-it.com/bad.html - display 404 error page - good
http://bad.xelr8-it.com - display 404 not found page from apache. We want this to be redirect to main domain.
Thank you for suggestion
Code: |
<VirtualHost *:80>
Options All -Indexes +Includes
ServerAlias *.xelr8-it.com
VirtualDocumentRoot /data/apache/xelr8-it.com/htdocs/office/veretekk/%-3
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
# Add error page on user folder
# Error is display corectly when path is specified to folder trivita
# <Directory /data/apache/xelr8-it.com/htdocs/office/veretekk/trivita >
#<Directory /data/apache/xelr8-it.com/htdocs/office/veretekk/%-3 >
# ErrorDocument 404 /404.html
#</Directory>
<Directory /data/apache/xelr8-it.com/htdocs/office/veretekk>
#ErrorDocument 404 http://xelr8-it.com/
#ErrorDocument 404 /404.html
</Directory>
ScriptAlias /cgi-bin/ /data/apache/xelr8-it.com/htdocs/cgi-local
<Directory "/data/apache/xelr8-it.com/htdocs/cgi-local">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
Options ExecCGI
SetHandler cgi-script
</Directory>
CustomLog /data/apache/log/apache2/access.log combined
ErrorLog /data/apache/log/apache2/error.log
LogLevel warn
XBitHack on
</VirtualHost>
|
|
|
Back to top |
|
veretekk
Joined: 23 Nov 2011 Posts: 3 Location: Wyoming
|
Posted: Wed 23 Nov '11 23:51 Post subject: |
|
|
IS it something like this?
RewriteCond %{HTTP_HOST} ^xxx.domain.com
RewriteRule (.*) http://domain.com/$1 [L] |
|
Back to top |
|
mantonik
Joined: 23 Nov 2011 Posts: 3
|
Posted: Thu 24 Nov '11 21:22 Post subject: |
|
|
Virtual root document is refered like :
Code: |
VirtualDocumentRoot /data/apache/xelr8-it.com/htdocs/office/veretekk/%-3
|
When I try use this in directory it is not working,
Is a way to define directory using root documnet?
Code: |
<Directory /data/apache/xelr8-it.com/htdocs/office/sub/%-3 >
ErrorDocument 404 /404.html
</Directory>
|
|
|
Back to top |
|