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
-
Deciding on domain
Hi, I have a company website that I have access to and it's bcannon.remax-mississippi.com. It allows you to choose a domain and have it 301 redirected so I changed it to Oxfordmissrealestate.com. I noticed that the page and domain authority for bcannon.remax-mississippi.com was pretty high so I took off the Oxfordmissrealestate.com domain and just left it as this subdomain. My question is, would you leave it how it is as the subdomain or change it? Thanks!
On-Page Optimization | | Veebs0 -
Duplicate meta data for 301 redirected items
Google webmaster tools tells me that I have duplicate title tags for two items. They have the same product ID. When there is a change in SEO URL, the system does an automatic 301 redirect of the first item towards the second item, like in the example below:
On-Page Optimization | | Madlena
22"x28" White Foam Board School Project Kit|Geographics.com
/p48998/foam-board-school-project-kit-22-x-28/product_info.html /p48998/white-foam-board-school-project-kit/product_info.html What are we doing wrong that Google asks for different meta data for a 301 redirect? Thanks!0 -
Duplicate biographies across several domains?
Hey Gang, We've built a niche specific, manually edited legal community that is full of unique content. (While it's ultimately a directory, and that is often viewed as a bad word in these times, ours is a curated source that doesn't allow anyone and everyone to join.) We feel comfortable that it passes the sniff test post-panda/penguin, etc., and its doing rather well to date. The question we have is do we really need to create unique biographies for each of our legal members? Some of our competitors simply use the same bio information that the lawyer has on their own website and copies that to their site. The competitors I'm talking about are LARGE, well-respected, extremely successful folks, like FindLaw. Here's an example: Lawyer's website bio FindLaw website bio Both rank, etc., and the FindLaw code doesn't place any restrictions on their content regarding the bio., and it's an obvious exact match. I get that duplicate content is primarily a concern among one's own URL and the pages across a specific domain, using rel-canonical, etc., but what about two different domains that need to supply factual information that can't be altered? Is it anything we should worry ourselves with? Any tags we should insert in our code with regard to the bios? Thanks!!! Wayne
On-Page Optimization | | Wayne760 -
The best way to redirect to www
What is the best way to redirect non www to www. I saw a lot of the solution. is this one ok? RewriteCond %{HTTP_HOST} !^www.seomoz.org [NC] RewriteRule (.*) http://www.seomoz.org/$1 [L,R=301]
On-Page Optimization | | bruki0 -
Too www. or not to www.?
what is the point of having www. in my URL? does this help, hurt, or influence anything?
On-Page Optimization | | SEODinosaur0 -
Redirect sub domain to domain in .htaccessU
Hi all, (Total newbie with fourth post of the last 7 days askin' for help!...sorry!) I've discovered that we have a lot of URLs indexed with for example: http://test.betxpert.com/some-odd-url This gives me duplicate content in the search engines. I have searched the web and i can not find a solution fore redirecting http://test.betxpert.com/some-odd-url to http://www.betxpert.com/some-odd-url. Can anyone help me what to write in the .htaccess file? Best regards, Rasmus
On-Page Optimization | | rasmusbang0 -
Exact Match Domains
Hi All Which strategy from below would be best for the purchase of an exact match domain... 1) www.shiny-blue-widgets.com 2) wwwshinybluewidgetsshop.com Wondered if there was much difference in either as I know both have plus and minus points.
On-Page Optimization | | PerchDigital0 -
Competitive Domain Analysis
In the competitve domian analysis my domain root (gpscity.com) is showing up as a 404 not found. My competition is showing up as 200. My site is live, index and viewable, but I'm wondering if this has an effect on my rankings? What can I do to test that it's not returning a 404 when the crawlers view my site?
On-Page Optimization | | tinyfactory0