tuckey urlrewrite, query string, remove www

219 Views Asked by At

How could I add WWW to the beginning of host-name forcibly by getting specific query-string of {key=value} combination. I use condition and redirect to define rule but it doesn't work.

Consider the domain is www.example.com that could be available via example.com too (without www).

There are several applications and web pages available under this domain name using query string such as: www.example.com/?mypageid=my_id.

Now I want to specify that some pages should be available just with www or without www. For example, page_id1 should be available without www and addresses with www should be redirected to example.com/?mypageid=page_id1. On the other hand page_id2 should be available just with www, and addresses without www should be redirected to www.example.com/?mypageid=page_id2 Now I want to filter these URls using tuckey urlrewrite rules and define condition for type="query-string". I provide an example that didn't work for me as follows:

<rule>
<name>WWW Check</name>
<condition type="query-string" operator="equal">?mypageid=page_id2</condition>
<from>^/(.*)$</from>
<to type="redirect" qsappend="true">https://www.example.com/$1</to>
</rule>
0

There are 0 best solutions below