How do I use only one URL
-
my site can be reach by both www.site.com and site.com. How do I make it only use www?
-
Thanks so much for the information!
-
Yes, sorry did not see the second link, and yes some web servers notably windows iis shared servers are pretty tricky at setting up .htaccess. Both are valid solutions though, just depends on circumstances.
-
Glad I could help weblion,
Malcolm that is a 301 redirect using .htaccess that you have written - the second link on my response shows you the different ways to go about implementing a 301 redirect including your method, which I have personally used on sites.
Not all web servers are compatible with 301 redirects using .htaccess, so I would definitely look at the different options for which best fits in with your setup.
-
Matt is right, but you may also want to use a .htaccess solution. Add this or get your devs to add this to your .htaccess file
<code class="htaccess" title="in your .htaccess file">RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]</code>
If you use this method plus Matt's then you may find you end up with a redirect loop. I personally use the .htaccess rule, but each to their own.
-
Thank you so much! This is what I was looking for.
-
Setup a 301 redirect (permanent) from site.com to www.site.com. You might find this guide useful - http://www.seomoz.org/learn-seo/redirection
And this will show you all the different ways of creating a 301 redirect - http://www.webconfs.com/how-to-redirect-a-webpage.php
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
-
Can you help by advising how to stop a URL from referring to another URL on my website with a 404 errorplease?
How to stop a URL from referring to another URL on my site. I'm getting a 404 error on a referred URL which is (https://webwritinglab.com/know-exactly-what-your-ideal-clients-want-in-8-easy-steps/[null id=43484])referred from URL (https://webwritinglab.com/know-exactly-what-your-ideal-clients-want-in-8-easy-steps/) The referred URL is the URL page that I want and I do not need it redirecting to the other URL as that's presenting a 404 error. I have tried saving the permalink in WordPress and recreated the .htaccess file and the problem is still there. Can you advise how to fix this please? Is it a case of removing the redirect? Is this advisable and how do I do that please? Thanks
Technical SEO | | Nichole.wynter20200 -
Should we use Cloudflare
Hi all, we want to speed up our website (hosted in Wordpress, traffic around 450,000 page views monthly), we use lots of images. And we're wondering about setting up on Cloudflare, however after searching a bit in Google I have seen some people say the change in IP, or possible sharing of Its with bad neighbourhoods, can really hit search rankings. So, I was wondering what the latest thinking is on this subject, would the increased speed and local server locations be a boost for SEO, moreso than a potential loss of rankings for changing IP? Thanks!
Technical SEO | | tiromedia1 -
Removed URLs
recently my site has got some problem some of my URLs are repeating in the SERP ! I removed them by search console and also site : but they show up again Does anyone know what is wrong?
Technical SEO | | talaabshode20200 -
URL 301 Re-direct
Hello, If we publish a blog post with a url which accidentally contains a number at the end (blog.companyname.com/subject-title-0), is it best-practice to update the URL (e.g. to blog.companyname.com/subject-title) and put in a 301 re-direct from the old to the new one or should it simply be left as is? I've read that 301's lose link equity and relevance so is it really worth re-directing for the sake of a cleaner url? Thanks for your input! John
Technical SEO | | SEOCT1 -
Should I use a canonical URL for images uploaded to a blog post in Wordpress?
Hi, I have a wordpress website that has articles/news posts witch contain imagery. I've noticed that in the Media Library, when you upload an image to a blog post it generates a new permalink ...article-name/article-image-01.jpg I have Yoast SEO plugin and have the option to set a canonical URL for this image. Should I point it back to the actual article? Thanks for any helpers with this.
Technical SEO | | Easigrass0 -
Old url is still indexed
A couple of months ago we requested a change of address in Search console. The new, correct url is already indexed. Yet when we search the old url (with site:www.) we find that the old url is still indexed. in Google Webmaster Tools the amount of indexed pages is reduced to 1. Is there another way to remove old urls?
Technical SEO | | conversal0 -
Changing URLs
As of right now we are using yahoo small business, when creating a product you have to declare an id, when we created the site we were not aware that you will not be able to change the id but also the ID is being used as the URL. we have a couple thousand products in which we will need to update the URLs. What would the best way to be to fix this without losing much juice from our current pages. Also I was thinking that if we did them all in a couple weeks it would hurt us a lot, and the best course of action would be to do a slow roll out of the URL changes. Any help is appreciated. Thank you!
Technical SEO | | TITOJAX0 -
Www or not www base url
Here is the situation. Developer custom coded a magento commerce shop for a seo client and is having problems adding www to the URL without breaking the site. They wont be able to get this completed until a couple months down the road. We are starting monthly SEO this June. Most directories and websites link to the www version of a site not the non www. What should I expect since we are ranking for the non-www and linking to the www version. In web master tools i'm telling google to display the URL as www.
Technical SEO | | waqid0