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
-
Old domain to new domain what happens to the old site?
Hello We rebranded 5 months ago, and set up a new domain for the new brand name which sits on different hosting to the old. We still have the old hosting running with the old site still on it. We have set up redirects to the new domain and wondered when/if we can turn off the old site hosting?
On-Page Optimization | | Scivisum0 -
Page Speed Insights for www and non www sites
I'm testing a client site for speed and I'm getting different results when I test www and non www. What's causing this from the same site? Non www scored 37/100 for mobile, very concerning www scored 54/100 for mobile, still problems but not as severe Can anyone shed any light on this please?
On-Page Optimization | | Marketing_Optimist0 -
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 -
Redirect both / and non-/ URLs?
I am doing SEO on WP site. Due to some duplicate pages (rel canonical was done before) I am doing 301 redirects at the moment. And I wonder if I need to redirect both links w/ and w/o trailing slash. Default is non www, w/o trailing slash. Like there is .com/category/news but there is same page linked in .com/news (well it works when permalink structure is set to /%category%/%postname% and returns 404 error when structure is set to /%postname%).
On-Page Optimization | | OVJ
I redirected .lt/naujienos to .lt/category/naujienos. Should I also redirect .lt/naujienos/ (with trailing slash)? There's absolutely no problem redirecting this, but there are some more pages which I want to edit their URLs and I wonder If I should do both redirects from links /w and w/o slash?1 -
Redirecting https pages
If I add 301 redirects from the https versions of the root domain to the http:www.website.com (canonical version), will this prevent users from being able to access the https version? I believe the https version is only accessed once users log into the site. Thank you!
On-Page Optimization | | HiddenPeak0 -
Cookie Free domains
What is the advantage of having a cookie free domain and how does one set this up on wordpress?
On-Page Optimization | | casper4340 -
With or without the "www." ?
Is there any benefit whatsoever to having the www. in the URL? My domain is quite long therefore I've not been using the www. however a few people have mentioned it's good practice to include it. The www. forwards to the main URL (non www.) and I've set my preferred domain name in webmaster tools to the non www. so I'm thinking that should all be ok. Just hoping I could get some of the experts views to make sure this is all ok. The site is a year old and I'm just starting to really get going on the link building so it's not too late to change if I'm wrong. If others link to my site and include the www. will the link juice be passed, as I suspect many will include it without any thought?
On-Page Optimization | | Optimise0 -
Www vs "non" www site addresses and SEO
I first apologize for the lame question title - didn't really know how to word it... I'm having a bit of a conundrum and cannot figure out whats going on, but in the mean time I thought I would ask to see if its hurting my ranking. My site at www.ap-mg.com is built on WordPress using the Thesis them by DIY (just a little upfront info). I am very careful to make sure that all my links are in a particular format i.e. http://www.ap-mg.com - on my site, as well as other sites I have my profile on. My site also used to be hosted on the /home directory until about a month ago. My problem is that when I click on the DA MoxBar link while at my sites homepage, it takes me to Open Explorer, but to ap-mg.com and shows no results - I then add the www to the front of the address and vuala - results. But then the second issue I'm having is then it tells me that my site is redirecting the the /home directory, which its not and I'm still trying to figure that one out. So with all the craziness with my site, www, no www, /home....is this killing any chance of real ranking?
On-Page Optimization | | apmgsmith0