Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: beast on April 06, 2010, 09:25:49 PM
-
Hi Everyone
Is it possible to setup wildcard catch for hostnames on an Ibay?
E.g. something like *.mydomain.xxx that will catch aaa.mydomain.xxx and also b.mydomain.xxx and direct it to the same ibay.
I know I can setup a specific hostname like www.mydomain.xxx in server-manager under hostnames and addresses but how do I set it up to catch anything in front of the ibay domain name (can also be the primary ibay if only possible this way).
What I like to end up with is to be able to detect the random part of the url in PHP (know how to do that part)
Thank you
NB: I have searched the forum and documentation for this with no results (it still might be there anyway)
-
If you wouldn't configure the domain names, all the requests would go to the primary ibay. You could add an apache rewrite rule in the .htaccess file that could check the requested url and do a redirect.
Something like:
RewriteCond %{HTTP_HOST} ^(.*.)?.mydomain.xxx$
RewriteRule ^(.*) http://www2.mydomain.xxx/$1 [R=301,L]
Of course you would also redirect www.mydomain.xxx, so the RewriteCond should be a little more extended.
-
If you wouldn't configure the domain names, all the requests would go to the primary ibay. You could add an apache rewrite rule in the .htaccess file that could check the requested url and do a redirect.
One of my servers does not show the primary ibay if I look up qwerty.domain.xxx another one does and the DNS is set up in the same way ???? And for sure the server that does not - is the one I need this behavior on :-D In stead it shows an error telling me that the page does not exist.
If only I was able to get the same behavior then I could move around the Ibay in question and the primary to make it behave as I need it to!
As far as I understand your solution it may be what I need - if only the server behaved correctly
-
RewriteCond %{HTTP_HOST} ^(.*.)?.mydomain.xxx$
RewriteRule ^(.*) http://www2.mydomain.xxx/$1 [R=301,L]
Of course you would also redirect www.mydomain.xxx, so the RewriteCond should be a little more extended.
This will not work as I will be unable to detect what is in front of mydomain.xxx in PHP - you redirect to a fixed page
-
No, the $1 should add the requested URL relative to the original root URL, so this is not a redirect to a fixed page.