Rewrite subdomains.

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
Sulcorp
-


Joined: 12 Mar 2007
Posts: 4

PostPosted: Fri Jan 23, 2009 1:40 pm    Post subject: Rewrite subdomains. Reply with quote

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 View user's profile Send private message
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Sat Jan 24, 2009 5:43 am    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Wed Jan 28, 2009 2:52 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Sulcorp
-


Joined: 12 Mar 2007
Posts: 4

PostPosted: Wed Jan 28, 2009 3:39 pm    Post subject: Reply with quote

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 View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun Feb 08, 2009 4:35 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group