DNS Setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



str tux wrote:
> Hello People,
> 
> In my DNS setting I added A record of www for our company website.
> 
> It works, when you go to http://www.mycompany.com; it resolves and it
> shows the website content.
> 
> But in addition, I want also some kind of redirection or mapping (i
> don't know what you called that) that when people go to
> http://mycompany.com (without www), it should forward also to the www
> server.
> 
> How to do it? Thanks in advance.

If you are using apache as the webserver, you can create a redirect to it:

Here is an apache2 mod_rewrite example:

# For sites running on a port other than 80
RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/(.*) 
http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]

# And for a site running on port 80
RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]

More Info:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

If you are running any other webserver...check it's docs.

Warm Regards,

--
Bruno Delbono
Open-Systems Group
http://www.open-systems.org/users/bruno/


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux