Question

I have set up a subsystem in my app:

example.com/index.cfm/subsys:foo/bar

What I want to do is map a subdomain to that subsystem to eliminate the need for the subsystem specification in the PATH

subsys.example.com/index.cfm/foo/bar

We serve our FW1 app through IIS6 currently, but may migrate to Apache, so a solution in either is acceptable.

Was it helpful?

Solution

With Apache's mod_rewrite you can do something like:

RewriteCond %{HTTP_HOST} ^(subsys)\.example\.com
RewriteRule /index.cfm/(.*) /index.cfm/%1:$1

To make it work with multiple subdomains/subsystems, use a pipe-delimited list inside the parentheses:

RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\.example\.com

To make it work for any non-www subdomain, for any domain, use a condition such as:

RewriteCond %{HTTP_HOST} ^((?!www\.)\w+)\.


For IIS6, you would probably need third-party software, such as Helicon Tech's ISAPI Rewrite, which supports mod_rewrite syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top