Forum Moderators: phranque

Message Too Old, No Replies

New to redirections, Pls Help

Absolutely know nothing abt redirection

         

xyris

1:50 am on Jan 11, 2005 (gmt 0)

10+ Year Member



Hi
I am the webmaster of [example....]
since i am a reseller, i have no direct access to httpd.conf
what i wish to do is
redirect [(subdomain).example.com...] to
[example.com...]
How may i acheive this without direct changes to httpd.conf
Does it require DNS Changes and if so, where to make them?
In the registrar or the dns zone in whm?
Please help as we are a hosting company
Thanking you
Xyris

[edited by: jdMorgan at 3:52 am (utc) on Jan. 11, 2005]
[edit reason] Examplified. Please see TOS. [/edit]

valder

3:26 am on Jan 11, 2005 (gmt 0)

10+ Year Member



Hi,

I believe I have a solution for you.

You need wildcards in your DNS. (*.domain.tld)

You need this in your .htaccess file:

RewriteEngine On
# Prevent infinite loops. The NC flag means case-insensitive
RewriteCond %{REQUEST_URI} !/forums/index\.php [NC]
# HTTP_HOST should not be empty
RewriteCond %{HTTP_HOST} .
# HTTP_HOST should not start with www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
# Take whatever is in front of .example.com and use parantheses, so it becomes a variable (%1).
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^([^.]+)\.infoxyris\.com(:80)?/.* [NC]
# use the variable and rewrite. Flags are: Last (rule), Query String Appending
RewriteRule .* /forums/index\.php?name=%1 [L,QSA]

Give it a try. As far as I can see at the moment, this should work like a dream :)

[edited by: jdMorgan at 3:55 am (utc) on Jan. 11, 2005]
[edit reason] Examplified domain. [/edit]

xyris

3:57 am on Jan 11, 2005 (gmt 0)

10+ Year Member



where to put the .htaccess file my friend?

valder

4:07 am on Jan 11, 2005 (gmt 0)

10+ Year Member



That would be the document root.
I hope you'll come back to tell us if it worked or not :)

-Eivind

xyris

4:10 am on Jan 11, 2005 (gmt 0)

10+ Year Member



I bought domain from godaddy
it asks me for name servers
i already have ns1.zinix.net and ns2.zinix.net as ns
what next should i add?

valder

4:16 am on Jan 11, 2005 (gmt 0)

10+ Year Member



I think you'll need to ask them if they can activate wild cards for your domain, so that *.domain.tld points to your domain.com (or perhaps somewhere else if you prefer). Should be pretty simple for them. If they won't do it, you should probably change your ISP.

..or perhaps that wasn't the problem you were refering to?