IIS redirect with querystring
August 12. 2015 0 Comments
- Posted in:
- IIS
To optimize SEO, the most common requirement is to redirect all non-www requests to www requests. i.e. redirect example.com.au to www.example.com.au. However, when you setup this 301 redirect in IIS, the querystring will be strip out. However, we can simply solve this by using IIS magic placeholder "$S$Q". For example, set the redirect destination to "www.example.com.au$S$Q".
So what $S$Q does?
IIS will replace $S with the subdirectory location i.e. /tickets and will replace $Q with querystring i.e. ?token=xyz
NOTE, you will need to tick the option "The exact URL entered above"
References:
[1] http://forums.iis.net/t/1170477.aspx?IIS7+passing+query+strings+or+URL+redirect
[2] http://www.developerfusion.com/code/4678/permanent-301-redirect-with-querystring-in-iis/
So what $S$Q does?
IIS will replace $S with the subdirectory location i.e. /tickets and will replace $Q with querystring i.e. ?token=xyz
NOTE, you will need to tick the option "The exact URL entered above"
References:
[1] http://forums.iis.net/t/1170477.aspx?IIS7+passing+query+strings+or+URL+redirect
[2] http://www.developerfusion.com/code/4678/permanent-301-redirect-with-querystring-in-iis/