LS Dynamic Subdomains / Request_Routing

#1
I have request_routing installed, and as far as I can tell there shouldn't be too much tweaking required from the plugin end to parse for subdomains, however, it doesn't work.

My .ls_rails_config is set up (and working) per default settings, as such:
Code:
RailsApp myapp "/rails_site_folder" "production" 4 1
RailsAppMap myapp "mysite.com" "/"
I understand that the point of routing, etc is to replace mod_rewrite, but a) do I need to include wildcards for the subdomains in .ls_rails_config; b) need to do some kind of application tweak to parse subdomains properly; c) something else?

I'm on a shared server, and I don't really have much LS admin experience, so I don't know whether I need my host to enable something for me.

The point, essentially, is to route subdomains dynamically to a particular url/param (eg, subdomain.site.com routes to site.com/controller/action/param).

Any thoughts? Sorry for my lack of expertise. :)
 

mistwang

LiteSpeed Staff
#2
You need to make sure the vhost "mysite.com" configured in your control panel to handle subdomains as well. add "subdomain.site.com" as an domain alias for the vhost.

Route subdomain dynamicially to a URL can be done via URL rewrite, same as what you would do with Apache.
 
#3
Thanks, that was a lot of help.

I have the rewrite working properly for the most part, and this is a little off-topic, but maybe someone knows the answer off the top of their head:

Part of my .htaccess looks like this:

Code:
RewriteCond %{HTTP_HOST} ([^.]+)\.mysite\.com
RewriteRule (.*) /redirect.php?s=%1 [L]
I want to add another wildcard, though, and parse not only the subdomain, but anything after the domain as well, so that (for example):

http://sub.mysite.com/something-else

rewrites to:

/redirect.php?s=sub&q=something-else

I'm alright with regex but maybe using it in rewrites is just phasing me.

I've done this:

Code:
RewriteCond %{HTTP_HOST} ([^.]+)\.mysite\.com
RewriteRule (.*)\.mysite\.com(.*) /redirect.php?s=%1%2 [L]
but that doesn't seem to work. Any quick tips for getting RewriteRule to use both wildcards?
 
Top