|
|

06-14-2006, 03:34 PM
|
|
Member
|
|
Join Date: Aug 2005
Posts: 21
|
|
problem with rewrite & 404 error
Hello,
I use rewrite rules to set up subdomains. Ive also set up 404 redirection to catch all traffic on currently `unused` subdomains ( ive also set it on in Customized Error Pages section ). Those are the rules which i use:
Quote:
RewriteCond %{SERVER_NAME} !^www\.example\.com$
RewriteCond %{SERVER_NAME} ^(www\.)?([a-z-]+)\.example\.com$
RewriteRule ^/(.*)$ /home/examplecom/public_html/%2/$1
ErrorDocument 404 /home/examplecom/public_html/index.html
|
The problem is that it only works for a http://example.com . If there is no dir `/home/examplecom/public_html/sss` and i try to access sss.example.com i simply get
Quote:
404 Not Found
The resource requested could not be found on this server! Powered By LiteSpeed Web Server
Lite Speed Technologies is not responsible for administration and contents of this web site!
|
( The traffic isnt redirected )
Is this a rewrite bug? Why `Customized Error Pages` doesnt work for the all subdomains in this vHost? Is there any way i can fix that or this is a litespeed bug?
Best Regards
Lukasz
|

06-14-2006, 06:06 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
I think you probably did not configure the listener to vhost mapping properly, you should use "*" or "*.example.com" as the matching domain.
|

06-15-2006, 01:36 AM
|
|
Member
|
|
Join Date: Aug 2005
Posts: 21
|
|
|
I use `*` so this is not a problem. I didnt mention. It maps the domains.
If there is a directory `test` and i enter test.example.com it will display the site located in /home/examplecom/www/test/.
The problem is only with 404 error redirection
|

06-15-2006, 08:19 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
The ErrorDocument directive bolow the rewrite rule does not work, only the vhost customized error page option works.
Can you post some debug logging. one working for example.com, one not working.
|

06-15-2006, 09:05 AM
|
|
Member
|
|
Join Date: Aug 2005
Posts: 21
|
|
For working subdomain:
Quote:
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] Rule: Match '/' with pattern '^/(.*)$', result: 2
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^www\.example\.com$', result: -1
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^(www\.)?([a-z-]+)\.example\.com$', result: 3
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] Source URI: '/' => Result URI: '/home/examplepl/public_html/tester/'
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] strip rewrite base: '/' from URI: '/'
2006-06-15 18:00:56.020 [INFO] [myIP:20646-0#example.com] [REWRITE] Rule: Match '' with pattern '^([^.]+)(\.html)?$', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Rule: Match '/favicon.ico' with pattern '^/(.*)$', result: 2
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match '/favicon.ico' with pattern '^/xstaty', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^www\.example\.com$', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^(www\.)?([a-z-]+)\.example\.com$', result: 3
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Source URI: '/favicon.ico' => Result URI: '/home/examplepl/public_html/tester/favicon.ico'
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] strip rewrite base: '/' from URI: '/favicon.ico'
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Rule: Match 'favicon.ico' with pattern '^([^.]+)(\.html)?$', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] File not found [/home/examplepl/public_html/tester/favicon.ico]
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Rule: Match '/' with pattern '^/(.*)$', result: 2
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match '/favicon.ico' with pattern '^/xstaty', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^www\.example\.com$', result: -1
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Cond: Match 'tester.example.com' with pattern '^(www\.)?([a-z-]+)\.example\.com$', result: 3
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] Source URI: '/' => Result URI: '/home/examplepl/public_html/tester/'
2006-06-15 18:00:56.613 [INFO] [myIP:20647-0#example.com] [REWRITE] strip rewrite base: '/' from URI: '/'
2006-06-15 18:00:56.614 [INFO] [myIP:20647-0#example.com] [REWRITE] Rule: Match '' with pattern '^([^.]+)(\.html)?$', result: -1
|
And if there is no website set:
Quote:
2006-06-15 18:02:26.268 [INFO] [myIP:20656-0#example.com] [REWRITE] Rule: Match '/' with pattern '^/(.*)$', result: 2
2006-06-15 18:02:26.268 [INFO] [myIP:20656-0#example.com] [REWRITE] Cond: Match 'sesesese.example.com' with pattern '^www\.example\.com$', result: -1
2006-06-15 18:02:26.268 [INFO] [myIP:20656-0#example.com] [REWRITE] Cond: Match 'sesesese.example.com' with pattern '^(www\.)?([a-z-]+)\.example\.com$', result: 3
2006-06-15 18:02:26.268 [INFO] [myIP:20656-0#example.com] [REWRITE] Source URI: '/' => Result URI: '/home/examplepl/public_html/sesesese/'
2006-06-15 18:02:26.291 [INFO] [myIP:20656-0#example.com] [REWRITE] strip rewrite base: '/' from URI: '/'
2006-06-15 18:02:26.291 [INFO] [myIP:20656-0#example.com] [REWRITE] Rule: Match '' with pattern '^([^.]+)(\.html)?$', result: -1
2006-06-15 18:02:26.291 [INFO] [myIP:20656-0#example.com] File not found [/home/examplepl/public_html/sesesese/]
2006-06-15 18:02:26.291 [ERROR] [myIP:20656-0#example.com] detect loop redirection.
|
Customized Error Pages:
404 Not Found http://example.com/index.html
|

06-17-2006, 07:54 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
The problem is that LSWS cannot found the file used for the error page under the missing subdomain. So it reports "detect loop redirection". You can add a static context /index.html pointing to /home/examplecom/public_html/index.html to fix it.
|

06-21-2006, 10:45 AM
|
|
Member
|
|
Join Date: Aug 2005
Posts: 21
|
|
|
Hello,
It works perfectly, thank you very much
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:48 PM.
|
|