View previous topic :: View next topic |
Author |
Message |
Sulcorp -
Joined: 12 Mar 2007 Posts: 4
|
Posted: Fri Jan 23, 2009 1:40 pm Post subject: Rewrite subdomains. |
|
|
I want to do the following;
if %Variablename%.domain.com
than domain.com/%variablename%
Except www.domain.com
Offcourse variable is depending on what users put it.
if %variablename% does not exist just goes to page not availble (since header isnt known in abyss)
i tried to find it but i had no luck, or i didnt look very well.
Tnx |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 955 Location: Michigan, USA
|
Posted: Sat Jan 24, 2009 5:43 am Post subject: |
|
|
You'll have to manually enter every redirection. That would mean one rule for each subdomain redirection.
Rule for testing.domain.com
(Of course, if this is X2, the host name must include *.domain.com)
Regex: /*
Case sensitive: doesn't matter, just leave checked
Condition 1 variable: HTTP Header: Host (HTTP_HOST)
Condition 1 operator: Matches with
Condition 1 regex: testing.domain.com
Condition 1 case sensitive: unchecked
Apply to subrequests too: leave checked
If this rule matches: Perform an external redirection
Redirect to: http://domain.com/testing/
Append query string: checked
Escape redirection location: checked
Status Code: 301 or 302
Follow the above for every subdomain you want redirected. Just change what's in bold face for each redirection. It's kind of a pain, but you're requesting a very specific setup.
As for non-existent subdomains, you'll have to have PHP handle that one in your custom 404 error page. The variable you're going to deal with is $_SERVER[HTTP_HOST] in PHP. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Wed Jan 28, 2009 2:52 pm Post subject: |
|
|
It seems to me like a better option would be a wildcard host for all your subdomains (*.domain.com) and then a php script that does the redirection. _________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
|
Sulcorp -
Joined: 12 Mar 2007 Posts: 4
|
Posted: Wed Jan 28, 2009 3:39 pm Post subject: |
|
|
rrinc wrote: | It seems to me like a better option would be a wildcard host for all your subdomains (*.domain.com) and then a php script that does the redirection. |
Well maybey this is a idea for next patch of Abyss, to built it in the redirect.
php isnt the solution for this bcs this is after you get to a page.
the header is before you get on a page so thats faster and the right way to do this. |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun Feb 08, 2009 4:35 pm Post subject: |
|
|
pkSML,
If you are using X2 and the new version 2.6, you can use the new backrefences %1..%9 gathered from the last matched condition.
Regex: ^/(.*)$
Case sensitive: doesn't matter, just leave checked
Condition 1 variable: HTTP Header: Host (HTTP_HOST)
Condition 1 operator: Matches with
Condition 1 regex: ^(.*).domain.com$
Condition 1 case sensitive: unchecked
Apply to subrequests too: leave checked
If this rule matches: Perform an external redirection
Redirect to: http://domain.com/%1/$1
Append query string: checked
Escape redirection location: checked
Status Code: 301 or 302 _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
|