LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-11-2012, 01:44 AM   #1
adam_1784
Member
 
Registered: Dec 2011
Posts: 41

Rep: Reputation: Disabled
Sub domain Redirect


HI,

I want to redirect all my sub domains to main domain using a wild card character.
I have done the following changes in the Vhost file:
ServerAlias *.mydomain.com
And then I add an 'A' record in named.conf
* 14400 IN A MyIp
This allows to redirect all sub domains to main domain.
But when I try to add 'CNAME' record it does not work.
It gives me an Error that 403 Forbidden you don't have permission to access this folder.
Should I make some more changes in settings for 'CNAME'?.
 
Old 01-11-2012, 02:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Divide this issue up. You an not have a problem that genuinely realtes to both DNS and Apache. Apache recieves a request for a domain on a port listening on an IP. It can never now about A or CNAME records in reaching it. So are you requesting a valid domain from Apache or not? Do some DNS digs to confirm that you are being told to go to the right IP for the right domain. And read the apache error / access logs!
 
Old 01-11-2012, 04:20 AM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

redirection of subdomain is maybe easier to do with Apache htaccess than in Named/BIND.

Some examples of redirecting subdomain to domain:
- subdomain to domain with htaccess
- subdomain redirect
google search

but there must be Apache configured for subdomain (in Vhost).

otherwise in your "named.conf" should be something like:
Code:
$ORIGIN domain.com.
$TTL 1H
@       IN              SOA  ns.web-ne.com. onfi.web-ne.com.  (
                                      2011041801  ; Serial
                                      7200       ; Refresh
                                      3600        ; Retry
                                      604800      ; Expire
                                      1H )     ; TTL

; Name Server (NS) records.
                            IN              NS   ns.domain.com.

; Mail Exchange (MX) records.
;    IN          MX   10 mail.domain.com.
;        IN      MX      10      ASPMX.L.GOOGLE.COM.
;        IN      MX      20      ALT1.ASPMX.L.GOOGLE.COM.


; Address (A) records.
domain.com.    IN      A       11.22.13.143
ns                      IN      A       11.22.13.143
;mail                    IN      A       11.22.13.143
www                    IN      A       11.22.13.143

; Aliases in Canonical Name (CNAME) records.
subdomain                    IN      CNAME   www
BEWARE: the zone file for domain CNAME should not contain any dots (.) as it will use the subdomain with www.domain.com

good luck
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] postfix - how do you redirect all emails to one user in same domain unibox Linux - Server 3 12-25-2011 10:11 AM
how to redirect mail to another address in the same domain jeddie Linux - Newbie 1 09-26-2011 11:15 AM
Parse final domain from redirect link. guest Programming 2 06-06-2011 12:07 AM
DNS redirect unresolved domain ebros Slackware 12 01-29-2011 01:59 AM
domain redirect squid sunlinux Linux - Server 1 03-15-2010 02:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration