Welcome to WebmasterWorld Guest from 54.91.71.108

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

How do you do a hostname canonicalization redirect?

     
6:01 pm on Mar 25, 2015 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 26, 2004
posts: 412
votes: 0


How do you change the .htaccess file, so that if people enter the whole website address http//.www.example.com or http.example.com or example.com - in other words, all the usual variations, always go to www.example.com - without any http, etc, also regardless if they enter the address in lower case or upper case please?
7:02 pm on Mar 25, 2015 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11681
votes: 205


change it from what?
it depends on the mod_rewrite and mod_alias directives you currently have in your .htaccess and httpd.conf files.
7:35 pm on Mar 25, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15636
votes: 795


You're looking for the domain-name-canonicalization redirect. This question has been asked at least once a week for all the years this site has been in existence, so a quick search constrained to the /apache/ subforum should bring up hundreds of examples.

I'm worried, though, that you've misunderstood something. There is nothing you can do to change the display of "http(s)://" because that decision is made by the browser. If it happens that some of your content is reachable by both http and https, that's a separate redirect. Same RewriteRule, additional RewriteCond.
7:44 pm on Mar 25, 2015 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11681
votes: 205


I think Dexie is referring to the http.example.com subdomain, not the HTTP: protocol.
10:11 pm on Mar 25, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15636
votes: 795


I sure hope so ;)

But as long as you're here, feel like editing the thread title to, er, something more useful?
6:29 am on Mar 26, 2015 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 26, 2004
posts: 412
votes: 0


No probs, just found the answer elsewhere! By the way, if you look at the website address of this forum, you'll see no mention of http!
7:16 am on Mar 26, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15636
votes: 795


if you look at the website address of this forum, you'll see no mention of http

I think it would be a big help and would clear up a lot of confusion if you would explain exactly what you mean by this :(
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members