Re: DNS Settings

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

 



On Mon, 2006-02-20 at 08:57 +0300, str tux wrote:
> 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.

There's three parts to that:

Having an A record for just your domain name.

Having your webserver accept connections for either domain name (server
name and server alias entries in the Apache configuration).  This is
covered in the Apache manual.

Having your webserver redirect requests for the domain name to the www.
prefixed one (a rewrite rule).  How do do this is an Apache FAQ, though
since I don't have the address for it handy, here's how to do it in
either a .htaccess file or the main configuration (the best option):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

(Substitute your real domain name where I've used "example.\com" and
"example.com".  NB:  Use "example.com" for faked up examples on the web,
rather than usurp someone else's domain name.)

You can do it without the last step, and have the server answer to both
regardless, but it harms caching and search engine indexing (your site
exists twice over, under the two fully-qualified domain names).  It is
best that requests to the non-preferred one are redirected with a 301
HTTP error to the preferred one.  That tells them not to use the old
address again.

-- 
Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux