Newbie Question

Using a single web hosting account to host multiple sites

Postby richardk » Mon Jun 29, 2009 11:06 am

What does the below mean? The request does not contain "?" ?

Yes.

The THE_REQUEST variable is the first line in the HTTP request headers, for example,
Code: Select all
GET /index.php HTTP/1.1

and
Code: Select all
GET /profile.php?mode=editprofile HTTP/1.1
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby weewah » Tue Jun 30, 2009 5:58 pm

Thanks.

For the first requirement, I'm expecting http://abcs1a.example.com.sg to be redirected to http://abc.example.com.sg/xxx/yyy/abcs1a.html. However, it is opening the default homepage pointed to by http://wwws1a.example.com.sg. The below is inside the virtual host in httpd.conf.

# Below is for subdomains
RewriteCond %{ENV:REDIRECT_STATUS} ^$
# Make sure it's not (!) a request to wwws1a.example.com.sg.
RewriteCond %{HTTP_HOST} !^wwws1a\.example\.com\.sg$ [NC]
# If it is a sub domain request (subdomain.example.com.sg)
RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.example\.com\.sg$ [NC]
# and it is a request for / (the site's root) rewrite the request to /xxx/yyy/subdomain.html
RewriteRule ^/$ /xxx/yyy/%1.html [PT,L]


I could not get the above to work.
weewah
 
Posts: 20
Joined: Fri Jun 12, 2009 6:37 am

Postby weewah » Tue Jun 30, 2009 9:14 pm

However, by changing PT to R=301, it works.

Code: Select all
  # Below is for subdomains
  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  # Make sure it's not (!) a request to wwws1a.example.com.sg.
  RewriteCond %{HTTP_HOST} !^wwws1a\.example\.com\.sg$ [NC]
  # If it is a sub domain request (subdomain.example.com.sg)
  RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.example\.com\.sg$ [NC]
  # and it is a request for / (the site's root) rewrite the request to /xxx/yyy/subdomain.html
  RewriteRule ^/$ /xxx/yyy/%1.html [R=301,L]


Is this the correct way to achieve the first requirement?
weewah
 
Posts: 20
Joined: Fri Jun 12, 2009 6:37 am

Postby richardk » Wed Jul 01, 2009 8:55 am

What is the full mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby weewah » Wed Jul 01, 2009 4:55 pm

The below two code segments make up my full code.

This is for the first requirement:

Code: Select all
RewriteEngine On
# Below is for subdomains
RewriteCond %{ENV:REDIRECT_STATUS} ^$
# Make sure it's not (!) a request to wwws1a.example.com.sg.
RewriteCond %{HTTP_HOST} !^wwws1a\.example\.com\.sg$ [NC]
# If it is a sub domain request (subdomain.example.com.sg)
RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.example\.com\.sg$ [NC]
# and it is a request for / (the site's root) rewrite the request to /xxx/yyy/subdomain.html
RewriteRule ^/$ /xxx/yyy/%1.html [R=301,L]


This is for the second requirement. I'm thinking it should be independent of the first?

Code: Select all
# If it's not a request to an existing file
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f
# and if it's not a request to an existing directory
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-d
# and it matches "pattern1" rewrite to /abc/def?type=pattern1.
RewriteRule ^/([\w\s\-&\(\)\.]+)$ /abc/def?type=$1[PT,L]


Thanks.
weewah
 
Posts: 20
Joined: Fri Jun 12, 2009 6:37 am

Postby richardk » Fri Jul 03, 2009 8:35 am

I'm thinking it should be independent of the first?

They should be, but you never know until you look at it all together. Next time could you post the whole thing in one go (RewriteEngine On and everything) as it is in the file.

Code: Select all
/abc/def?type=$1[PT,L]

There is a missing space before the flags. If that isn't the problem, add
Code: Select all
RewriteLogLevel 9
RewriteLog      "/path/to/rewrite.log"

and see what happens when you request / with the PT flag. (Post the relevant parts of the log here.)
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby weewah » Tue Jul 14, 2009 5:52 pm

Thanks for your advice so far. ;)

Here's my full code:
Code: Select all
  # Enable the rewrite engine
  RewriteEngine on
  RewriteLogLevel 9
  RewriteLog "/opt/ihs/v61/ihss1a/logs/rewrite.log"
  # Below is for subdomains
  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  # Make sure it's not (!) a request to wwws1a.abc.com.sg.
  RewriteCond %{HTTP_HOST} !^wwws1a\.abc\.com\.sg$ [NC]
  # If it is a sub domain request (subdomain.abc.com.sg)
  RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.abc\.com\.sg$ [NC]
  # and it is a request for / (the site's root) rewrite the request to /xxx/yyy?page=subdomain.
  RewriteRule ^/$ /web/aa17/%1.html [PT,L]

  # Below is for friendly company URL
  # If it's not a request to an existing file
  RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f
  # and if it's not a request to an existing directory
  RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-d
  # and it matches "company" rewrite to /webapp/AA17abc/ipd-app/public/companies/myCompany.jspa?name=company
  RewriteRule ^/([\w\s\-&\(\)\.]+)$ /webapp/AA17abc/ipd-app/public/companies/myCompany.jspa?name=$1 [PT,L]


The above behaves quite strangely. When I requested for http://fnbs1a.abc.com.sg, according to the rewrite.log, it can rewrite to => /web/aa17/fnbs1a.html. However, instead of opening the page (which exists), rewrites continues. For http://motors1a.abc.com.sg though, the page http://motors1a.abc.com.sg/web/aa17/motors1a.html is opened correctly.

For the second rewrite condition and from the rewrite.log, I also found that the rewrite engine is rewriting URL that it is not supposed to as well. i.e. Only to rewrite http://www.abc.com.sg/xyx and not URLs with multiple levels like http://www.abc.com.sg/xxx/yyy.

How do I make the 2 rewrite rules independent of each other?

Here's the rewrite.log contents... sorry it is a bit long...
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (2) init rewrite engine with requested uri /
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (3) applying pattern '^/$' to uri '/'
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (4) RewriteCond: input='' pattern='^$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (4) RewriteCond: input='fnbs1a.abc.com.sg' pattern='!^wwws1a\.abc\.com\.sg$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (4) RewriteCond: input='fnbs1a.abc.com.sg' pattern='^([a-z0-9]+)\.abc\.com\.sg$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (2) rewrite / -> /web/aa17/fnbs1a.html
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [fnbs1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (2) forcing '/web/aa17/fnbs1a.html' to get passed through to next API URI-to-filename handler

    ## I expect it to stop here and open the page.
    But it continues... /web/aa17abc/... is more than 1 level... how to make it stop for such requests?


    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (2) init rewrite engine with requested uri /webapp/AA17abc/index.jsp
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/$' to uri '/webapp/AA17abc/index.jsp'
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/webapp/AA17abc/index.jsp'
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (1) pass through /webapp/AA17abc/index.jsp
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (2) init rewrite engine with requested uri /webapp/AA17abc/ipd-app/public/index.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (3) applying pattern '^/$' to uri '/webapp/AA17abc/ipd-app/public/index.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/webapp/AA17abc/ipd-app/public/index.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (1) pass through /webapp/AA17abc/ipd-app/public/index.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/membercss.css
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/membercss.css'
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/membercss.css'
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/membercss.css
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70cbd0/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/thickbox.css
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70cbd0/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/thickbox.css'
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70cbd0/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/thickbox.css'
    203.102.115.44 - - [15/Jul/2009:09:10:31 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70cbd0/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/css/membercss/thickbox.css
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/js/jquery.min.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/jquery.min.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/jquery.min.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/js/jquery.min.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/js/thickbox.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/thickbox.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/thickbox.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/js/thickbox.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6aaee8/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/breadcrumb/breadcrumb.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6aaee8/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/breadcrumb/breadcrumb.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6aaee8/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/breadcrumb/breadcrumb.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6aaee8/initial] (1) pass through /web/aa17/ipd-app/modules/breadcrumb/breadcrumb.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#4e302798/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/message/message.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#4e302798/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/message/message.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#4e302798/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/message/message.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#4e302798/initial] (1) pass through /web/aa17/ipd-app/modules/message/message.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/css/jscroller/jscroller.css
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/jscroller/jscroller.css'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/css/jscroller/jscroller.css'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/css/jscroller/jscroller.css
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/js/jscroller.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/jscroller.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/js/jscroller.js'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6f4c40/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/js/jscroller.js
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/tweak.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/tweak.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/tweak.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/tweak.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/abclogo.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/abclogo.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/abclogo.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/abclogo.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/header.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/header.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/header.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/header.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubottom.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubottom.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubottom.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubottom.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/login_singpass.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/login_singpass.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/login_singpass.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/login_singpass.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/mastbk.jpg
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/mastbk.jpg'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/mastbk.jpg'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/mastbk.jpg
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6eec28/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubk.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6eec28/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubk.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6eec28/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubk.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6eec28/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/menubk.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_affliate.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_affliate.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_affliate.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#702c78/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_affliate.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/arrow.png
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/arrow.png'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/arrow.png'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e4c00/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/arrow.png
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_enterpriseone.jpg
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_enterpriseone.jpg'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_enterpriseone.jpg'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fac58/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_enterpriseone.jpg
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70ebd8/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_biz_space.png
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70ebd8/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_biz_space.png'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70ebd8/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_biz_space.png'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#70ebd8/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/banner_biz_space.png
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/icon_search.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/icon_search.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/icon_search.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#706c88/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/icon_search.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_top.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_top.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_top.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_top.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bk.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bk.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bk.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#710be0/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bk.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bottom.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bottom.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bottom.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/footer_bottom.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/searchboxmin.gif
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/searchboxmin.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/searchboxmin.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:32 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/searchboxmin.gif
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (2) init rewrite engine with requested uri /webapp/AA17abc/ipd-app/public/displayMessage.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (3) applying pattern '^/$' to uri '/webapp/AA17abc/ipd-app/public/displayMessage.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/webapp/AA17abc/ipd-app/public/displayMessage.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#712be8/initial] (1) pass through /webapp/AA17abc/ipd-app/public/displayMessage.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (2) init rewrite engine with requested uri /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/loadinganimation.gif
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (3) applying pattern '^/$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/loadinganimation.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/loadinganimation.gif'
    203.102.115.44 - - [15/Jul/2009:09:10:33 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#708c90/initial] (1) pass through /web/aa17/ipd-app/modules/ipd-admin/resources/images/menuimg/loadinganimation.gif
    203.102.115.44 - - [15/Jul/2009:09:10:36 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e8c10/initial] (2) init rewrite engine with requested uri /webapp/AA17abc/ipd-app/public/newsflash/business/latest.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:36 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e8c10/initial] (3) applying pattern '^/$' to uri '/webapp/AA17abc/ipd-app/public/newsflash/business/latest.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:36 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e8c10/initial] (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/webapp/AA17abc/ipd-app/public/newsflash/business/latest.jspa'
    203.102.115.44 - - [15/Jul/2009:09:10:36 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6e8c10/initial] (1) pass through /webapp/AA17abc/ipd-app/public/newsflash/business/latest.jspa
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (2) init rewrite engine with requested uri /
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (3) applying pattern '^/$' to uri '/'
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (4) RewriteCond: input='' pattern='^$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (4) RewriteCond: input='motors1a.abc.com.sg' pattern='!^wwws1a\.abc\.com\.sg$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (4) RewriteCond: input='motors1a.abc.com.sg' pattern='^([a-z0-9]+)\.abc\.com\.sg$' => matched
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (2) rewrite / -> /web/aa17/motors1a.html
    203.102.115.44 - - [15/Jul/2009:09:10:39 +0800] [motors1a.abc.com.sg/sid#4b5858][rid#6fcc60/initial] (2) forcing '/web/aa17/motors1a.html' to get passed through to next API URI-to-filename handler


    ## This behaviour is correct. The page is opened.



Thanks for your help!
weewah
 
Posts: 20
Joined: Fri Jun 12, 2009 6:37 am

Postby richardk » Wed Jul 15, 2009 12:15 pm

The above behaves quite strangely. When I requested for http://fnbs1a.abc.com.sg, according to the rewrite.log, it can rewrite to => /web/aa17/fnbs1a.html. However, instead of opening the page (which exists), rewrites continues.

It continues with a different URL (/webapp/AA17abc/index.jsp). Is it related to the original request?
203.102.115.44 - - [15/Jul/2009:09:10:27 +0800] [wwws1a.abc.com.sg/sid#4b5858][rid#6fec68/initial] (2) init rewrite engine with requested uri /webapp/AA17abc/index.jsp


For the second rewrite condition and from the rewrite.log, I also found that the rewrite engine is rewriting URL that it is not supposed to as well. i.e. Only to rewrite http://www.abc.com.sg/xyx and not URLs with multiple levels like http://www.abc.com.sg/xxx/yyy.

How do I make the 2 rewrite rules independent of each other?

It's normal, all requests are tested against the RewriteRules. For example
Code: Select all
# A new request, so mod_rewrite starts.
... (2) init rewrite engine with requested uri /webapp/AA17abc/index.jsp
# The first rule is tested, it does not match, nothing happens.
... (3) applying pattern '^/$' to uri '/webapp/AA17abc/index.jsp'
# The second rule is tested, it does not match, nothing happens.
... (3) applying pattern '^/([\w\s\-&\(\)\.]+)$' to uri '/webapp/AA17abc/index.jsp'
# The request continues.
... (1) pass through /webapp/AA17abc/index.jsp
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby weewah » Wed Jul 15, 2009 6:12 pm

It continues with a different URL (/webapp/AA17abc/index.jsp). Is it related to the original request?

The URL (/webapp/AA17abc/index.jsp) is the home page. I am expecting it to open the URL /web/aa17/fnbs1a.html. The request to http://motors1a.abc.com.sg works and the URL /web/aa17/motors1a.html is opened without continuing to the URL /webapp/AA17abc/index.jsp.

It's normal, all requests are tested against the RewriteRules

How do I make the rules independent of each other? How do I stop the rewrite process for requests other than those I keyed in the URL bar?
weewah
 
Posts: 20
Joined: Fri Jun 12, 2009 6:37 am

Postby richardk » Thu Jul 16, 2009 1:14 pm

The URL (/webapp/AA17abc/index.jsp) is the home page. I am expecting it to open the URL /web/aa17/fnbs1a.html.

Mod_rewrite is requesting /web/aa17/fnbs1a.html
(2) forcing '/web/aa17/fnbs1a.html' to get passed through to next API URI-to-filename handler

if that is not the page that is loaded i don't think mod_rewrite is the problem.

How do I make the rules independent of each other? How do I stop the rewrite process for requests other than those I keyed in the URL bar?

You can't, don't worry about it. It has to run for every request, it can't guess (any "should it run?" would require the rules to be processed).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

PreviousNext

Return to Domain Handling

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron