homepage Welcome to WebmasterWorld Guest from 54.198.42.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Default Mod Rewrite on Dedicated Server
Jessica97




msg:1500987
 5:15 pm on May 25, 2006 (gmt 0)

I have a question with regards to the htaccess files or http.conf files in Apache with regards to redirection rules.

What I'm trying to find out is if it is possible to do have a setting somewhere in apache so that by default all instances of domainname.com (without the www) are always redirected to www.domainname.com.

Right now, the client has to create the domain name in their Web Host Manager screen, then they have to modify an htaccess file and then upload it for each domain in order to do the redirect so that there is not duplicate content served by Apache on both domainname.com and www.domainname.com

Instead of having to do this manually for each domain, I was wondering if there would be a better, more automated solution in terms of a wildcard entry somewhere in Apache or in httpd.conf that says

whenever a new domain is created, just always redirect the content to the www. version of each site, without having to manually either create rules in the httpd.conf file or setup individual htaccess files in each domains folders.

Has anyone run into this situation before, and if so, do you have any ideas to automate the process?

Thank you.

 

jdMorgan




msg:1500988
 6:06 pm on May 25, 2006 (gmt 0)

It's easy enough to implement in httpd.conf or conf.d, but I wouldn't recommend it.

One point that's often missed in the 'gripe session' threads about domain canonicalization --where the posters complain that Gooogle or other SEs should 'handle it' automatically-- is that "www" and non-www are not the same host.

Technically, "www.example.com" is a subdomain of "example.com" and need not contain the same content. There is absolutely nothing special about "www" -- it is just another arbitrary subdomain name, like "search" or "shopping" as used on major portals.

However, in the old days, "example.com" was used as the 'intranet' doamin for employees inside a company, while "www.example.com" was the publically-accessible Web site. This made the distinction clear, and made it easy to set up a firewall to protect the private intranet.

Now, with the commoditization of Web sites, the distinction is not clear if there is no 'intranet' -- that is, if there is no separate server space for private company use on a site. This is much more common now that anybody can have a domain and a Web site, and they're not reserved for large corporations any more.

So, the problem you would face is that some users would want "www" as the canonical name, some would want the non-www version, and some might want to keep both so that they could have separate content on the two hostnames.

If you take a look at some of the aforementioned canonicalization threads here on WebmasterWorld, you'll see that the split between those who prefer non-www vs. those who prefer www means that you'd make a good number of clients (or potential clients) unhappy.

Best practice would be to leave it as a cpanel settings, but emphasize in your customer welcome letter and FAQ pages that picking one or the other is highly recommended.

Jim

Jessica97




msg:1500989
 12:01 am on May 28, 2006 (gmt 0)

Jim,

Thanks for your response and for the detailed info in terms of what else to watch out for.

I do however, have a client who has their own server and I'm looking for a solution to have all of their sites come up as www.domain name because as it stands now, I'm the one that has to go in and manually upload the .htaccess file individually, and this takes way too much time that I could be spending doing much more productive things. There's no one else hosted on this server--just their sites. I understand that it won't be a solution for everyone and all servers, but could you share with me the solution on what to put in the httpd.conf file so that at least for this one client, I'm not stuck doing each and every site by hand?

Thank you!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved