Point subdomain - newbie

12 views
Skip to first unread message

Ski3r

unread,
Oct 27, 2009, 11:58:12 AM10/27/09
to UrlRewrite
Hi!
I'm trying to point a subdomain to a page on the main domain but the
url result gets dublicated:

http://test.mydomain.com/abc/Servlet?parent=sX&page=6/abc/Servlet?parent=sX&page=6

This is the code I'm using:

<name>Test Sub Domain Name Check</name>
<condition name="host" operator="equal">test.mydomain.com</
condition>
<from>(.*)</from>
<to type="redirect">%{context-path}/abc/Servlet?
parent=sX&amp;page=6</to>
</rule>

How should I write it?
Best regards,

Avlesh Singh

unread,
Oct 27, 2009, 10:12:11 PM10/27/09
to urlre...@googlegroups.com
I am sorry but you would need to elaborate on what is your requirement to get more help.

First, from the rule, it seems that you want to re-write ALL the URL's to a single URL. Is that true?
Second, for most use cases URI's (with or without query string) are dealt with in rewrite rules. Being specific, I could not understand the use of %{context-path}.

Cheers
Avlesh

Henrik Eriksson

unread,
Oct 28, 2009, 6:51:12 AM10/28/09
to urlre...@googlegroups.com
Thanks for the answer!

What i'm trying to do is to redirect all the traffic that comes to
"http:\\test.mydomain.com" to
"www.mydomain.com/abc/Servlet?page=6..."

Best regards.


2009/10/28, Avlesh Singh <avl...@gmail.com>:

Avlesh Singh

unread,
Oct 28, 2009, 7:19:21 AM10/28/09
to urlre...@googlegroups.com
What i'm trying to do is to redirect all the traffic that comes to "http:\\test.mydomain.com" to "www.mydomain.com/abc/Servlet?page=6..."

Underneath is what you need -
<rule>

  <condition name="host" operator="equal">test.mydomain.com</condition>
  <from>(.*)</from>
  <to type="redirect">http://www.mydomain.com/abc/Servlet?parent=sX&amp;page=6</to>
</rule>
 
This would redirect ALL the requests for "test.mydomain.com" to "www.mydomain.com" and that too to a FIXED url.

Cheers
Avlesh

Henrik Eriksson

unread,
Oct 28, 2009, 7:47:21 AM10/28/09
to urlre...@googlegroups.com
Hi again!
It almost works, it still get's dublicated and I'll be redirected to:
http://www.mydomain.com/abc/Servlet?parent=sX&amp;page=6http://www.mydomain.com/abc/Servlet?parent=sX&amp;page=6
Is it a bug maby?
Best regards,

2009/10/28 Avlesh Singh <avl...@gmail.com>

Avlesh Singh

unread,
Oct 28, 2009, 8:37:29 AM10/28/09
to urlre...@googlegroups.com
Nope. There is no bug in the filter.
Most probably, your code in the "www.mydomain.com/abc/Servlet" is trying to perform a redirect on its own. Check your code.

To test, in <to> add this url - "http://www.mydomain.com/some-imaginary-url.html". Assuming that you have no such URL mapped to any sevlet, you should get a 404 status code with the URL remaining exactly the same as imaginary url (without duplication).

Cheers
Avlesh
Reply all
Reply to author
Forward
0 new messages