kevinkt
(Kevin)
1
Hey guys!
I am in need of a dynamic subdomain to work. My current URL is
http://DOMAIN.com/con/view?id=1
I have a route that does this
'http://<id:\w+>.DOMAIN.com/' => 'con/view',
I also set up wildcard subdomains in my DNS settings. *.domain.com
Currently when going to my subdomain, it shows the sysdefault error message.
What am I missing to get this working?
hrnair
(Harikrishnan Hr)
2
I think you should use the redirect settings for the subdomain in the web server level, like in .htaccess in Apache, server in nginx etc
kevinkt
(Kevin)
3
I tried various .htaccess settings as well, but unable to get this to work.
hrnair
(Harikrishnan Hr)
4
you my try this in .htaccess
RewriteCond %{HTTP_HOST} ^([^.]*)\.domain\.com(.*)$ [NC]
RewriteRule ^(.*)$ http://domain.com/con/view?id=%1/$1 [R=301,L]
This is written on two conditions:
-
www.domain is redirected to domain. This code should come after that redirection.
-
Any parameters other than id is not considered in the code above. You may modify as per your conditions.
I have not tested, but think that it should work.