Forum Moderators: phranque

Message Too Old, No Replies

WWW redirect on htaccess or Registrar?

         

born2run

7:45 pm on Apr 3, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi so I wanted to know that my redirect for all "example.com" requests to goto "www.example.com" should be in my apache server account's .htaccess file or in my domain registrar? Thanks!

lucy24

11:15 pm on Apr 3, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



With/without www has nothing to do with the registrar or even the DNS*. Did you mean the host, who maintains the config file? It's true that “www.” is technically a subdomain, but it doesn't behave the same as other subdomains.

Keep all your redirects in one place. In this case, that means the site's htaccess file.


* With possible rare, bizarre exceptions that we need not think about.

phranque

3:41 am on Apr 4, 2018 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



just to clarify how this works, the registrar is about domain ownership/contact information and refers to the domain name servers.

the dns points hostnames to server IP addresses.
the dns can be configured so example.com goes to one one IP and www.example.com goes to a different IP and blog.example.com goes to another, etc.
it is also possible to allow a wildcard subdomain specification for an address record.

where requests for example.com vs www.example.com are served depends on how the dns is configured.
if the dns is configured so any or all hostnames (subdomains) of example.com point to the same web server, the web server can be configured so each hostname has its own virtual host configuration or a virtual host configuration can also specify a wildcard subdomain.

other than the conventional usage of www.example.com as the default or preferred hostname for serving web content, its behavior is exactly as any other arbitrary subdomain similarly configured.

Hi so I wanted to know that my redirect for all "example.com" requests to goto "www.example.com" should be in my apache server account's .htaccess file or in my domain registrar?

the directives for redirecting example.com requests to www.example.com should reside on the server (more specifically the example.com virtual host) in either the document root directory's .htaccess file or in the server config file within the appropriate VirtualHost or Directory context.

born2run

12:01 am on Apr 6, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok I have it on htaccess for now but I noticed G domains has option to forward example.com to www.example.com

lucy24

12:41 am on Apr 6, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your host probably has the option too (mine says with-www only, without only, or both). But, since it is done somewhere other than your own htaccess, it can lead to chained redirects. Always better to keep things under your own control.

phranque

2:28 am on Apr 6, 2018 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



^^that^^

born2run

9:31 pm on Apr 6, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok thanks all! :-) htaccess