Redirect www.domain to domain
-
How do I redirect www.entrepreneurhandbook.co.uk to entrepreneurhandbook.co.uk
The latter is an existing site.
Thanks
James
-
Good job covering Windows as well as Linux.
-
force non-www
RewriteCond %{HTTP_HOST} ^entrepreneurhandbook.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.entrepreneurhandbook.co.uk$
RewriteRule ^/?$ "http://entrepreneurhandbook.co.uk/" [R=301,L]Add the code listed above to your HTACESS file. This version will redirect both versions to the non-www version. The hashtag won't matter if you have that in there, that is for labeling your redirects. Makes navigating your HTACCESS file a lot easier.
-
It can be a bit tricky.
This short and simple how to might help.
http://kb.mediatemple.net/questions/242/How+do+I+redirect+my+site+using+a+.htaccess+file%3F
-
Alternatively:
Apache Webserver: RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]Windows Server/IIS:
-
Start Internet Services Manager. or start the IIS Snap-in in Microsoft Management Console (MMC).
-
Click to expand * server name, where server name is the name of the server.
-
Right-click either the Web site or the folder that you want to redirect, and then click Properties.
-
Click one of the following tabs that is appropriate to your situation:
-
Home Directory
-
Virtual Directory
-
Directory
-
Under When connecting to this resource, the content should come from, click A redirection to a URL.
-
Type the URL of the destination folder or Web site in the Redirect to box.
For example, to redirect all requests for files located at www.mycompany.com to mycompany.com type http://mycompany.com
- Click OK.
-
-
<code>Add the following to the.htaccess file in the root directory of your site</code>
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
MOZ identifies duplicate titles - one has' www' in the title
MOZ has identified duplicate titles - one has' www' in the title. - we have a few pieces of content where the same thing is happening. Not sure how this has happened. Should we do something about this? Will it cause problems for ranking? | KETAMINE GUIDE FOR DRUG WORKERS - free | Harm reduction informationhttp://substance.org.uk/harm-reduction-information/ketamine-guide-for-drug-workers-free | 13 | 2 |
On-Page Optimization | | Substance-create
| KETAMINE GUIDE FOR DRUG WORKERS - free | Harm reduction informationhttp://www.substance.org.uk/harm-reduction-information/ketamine-guide-for-drug-workers-free | 13 | 4 | 1 - 2 of 20 -
Is a mobile domain necessary?
Greetings all, I'm starting to build a mobile version of our website to be ready for April 21st. Question is: is it absolutely necessary to have a mobile domain name or can I just direct users to same domain/folder? in other words: www.mywebsite.com/mobile vs m.mywebsite.com - does this even matter? As always, thank you!
On-Page Optimization | | md30 -
Will pushing a visitor to a conversion page hosted on a 3rd-party domain hurt the landing page ranking
Had an interesting question from a client. The client has a page that is optimized for a specific term. The goal of the page is to push users to sign-up for a trial. The trial registration (conversion) page is hosted by a third-party. Will pushing users to the conversion page cannibalize the SEO authority of the landing page. My reflexive answer is to say no, but now am not so sure.
On-Page Optimization | | infoblue0 -
Google showing my content on the serps in a different domain
Hi all, Recently a partner of ours discovered that Google is showing a meta description on the serps for his homepage that is not his but ours. On his site, he sells add-ons for our software, so the name of our software appears many times and as well there are many links pointing to our site. He claims he hasn´t copied this text from us, and I have used some tools to verify this. I don´t understand how Google can get confused and show our text as the meta desctiption on the serps for his homepage. Any idea on why this happened?
On-Page Optimization | | Paessler0 -
Www.sitename.com or sitename.com?
A client of mine's site is currently sitename.com. www.sitename.com redirects to the non-www URL and the canonical is using the non-www URL. This is a fairly new site and there aren't many existing inbound links. Is there a benefit to switching this?
On-Page Optimization | | BostonWright0 -
Trying to maintain rank while switching back & forth from sitewide 301 to 302 redirects?
My company's website has earned industry "authority" over the years and ranks well for a number of keywords. For reasons not worth explaining, we've moved the entire site (all pages) to be secured (https from http). When we launch our completely new website in 5 months from now, we will launch it as "http:" For the next 5 months, we're stuck with using site-wide "https". Is it better to 301 or 302 all pages (from http -> https), with the intent to move back to 301 in 5 months from now? Obviously, this situation is not ideal, but we'd like to preserve as much authority/presence as possible. What should we do and why? Any input would be greatly appreciated!
On-Page Optimization | | WhiteCap0 -
Transferring authority from one domain to another
My dilemma For example: If I have a website ranking at number 11 for (Keyword) and there is a site named www.(Keyword).com ranking at number 12 for (Keyword), if I were to buy this site and redirect to my own site, would this be at all beneficial? Any advice would be much appreciated!
On-Page Optimization | | CMoore850 -
Is the www and non www isue realy seen by Google as duplicate content?
I realy don't understand how Google could posibly devaluate a link because the site displays the same content with www and without www. I mean did somebody recently saw a devaluation of a domain because of this isue? I somehow can not belive this because it is the standard when geting a new webspace that the new website display the same content with and without www. Is a redirect realy necessary?
On-Page Optimization | | MichaelJanik0