301 Re Direct Question for www
-
Can smeone check this code to make sure it is right so thaqt my site uses www always.
RewriteCond %{HTTP_HOST} ^exercisebiology.com [NC]
RewriteRule ^(.*)$ http://www.exercisebiology.com/$1 [R=301,L]
I had the hostgators customer service personnel perform this. But I cannot get it to redirect. But he says it works.
-
Yea That's what I think.
I tried adding the traoling slash with 301 redirecet, but it didn't work.
RewriteEngine On
RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.)/$ RewriteRule ^(.)$ http://www.exercisebiology.com/$1/ [L,R=301]This was the code I used. Can you tell me what is wrong please?
-
Does your site use the "index.php" version of the page with parameters to handle logins? In that case, you can't 301-redirect the page across the board. You'd have to do it selectively (only for the version with no parameters), and that's going to take custom-coding. You'd probably be better off with a canonical tag, in that situation - it would keep Google from indexing the variants (including the login pages, which have no search value).
-
Thanks!
1. Can you show me how to do a redirect for for http://www.exercisebiology.comto http://www.exercisebiology.com/ I want to add the trailing slash.
2. Also how to redirect from http://www.exercisebiology.com/index.php
to http://www.exercisebiology.com/.
When I tried to redirect the index.php last time, I couldn't login to the forums. Everytime when someone tries to login to my forums, it takes them the to the home page. I did it through the hostgator CP. I am thinking someone could help me here.
Thank you so much!
-
I see you have canonical tags in place. Considering that, I would suggest you are good. No need to setup any of those redirects. Canonical tags are in essence sort of 301's anyways, so you are all set.
-
Thank you. Worked like a charm.
Since we are on the topic, do you know how I can put a redirect for these pages: For every article, I have a few of these duplicate titles. I removed the pagination tags so it wont give out any more P's and N's But I am guessing I should do redirect. Should I ? **Here is an example of one article and the URL's with page numbers. **
/index.php/site/articles/does_testosterone_supplement_tribulus_work//index.php/site/articles/does_testosterone_supplement_tribulus_work/N12//index.php/site/articles/does_testosterone_supplement_tribulus_work/N1564//index.php/site/articles/does_testosterone_supplement_tribulus_work/N1568//index.php/site/articles/does_testosterone_supplement_tribulus_work/N1572/P12//index.php/site/articles/does_testosterone_supplement_tribulus_work/N1572/P18//index.php/site/articles/does_testosterone_supplement_tribulus_work/N1572/P6//index.php/site/articles/does_testosterone_supplement_tribulus_work/N16//index.php/site/articles/does_testosterone_supplement_tribulus_work/N4/P18//index.php/site/articles/does_testosterone_supplement_tribulus_work/N4/P6//index.php/site/articles/does_testosterone_supplement_tribulus_work/N8/P12//index.php/site/articles/does_testosterone_supplement_tribulus_work/N8/P6//index.php/site/articles/does_testosterone_supplement_tribulus_work/P12/N1572//index.php/site/articles/does_testosterone_supplement_tribulus_work/P12/N8//index.php/site/articles/does_testosterone_supplement_tribulus_work/P18/N1572//index.php/site/articles/does_testosterone_supplement_tribulus_work/P18/N4//index.php/site/articles/does_testosterone_supplement_tribulus_work/P18/N8//index.php/site/articles/does_testosterone_supplement_tribulus_work/P6/N1572//index.php/site/articles/does_testosterone_supplement_tribulus_work/P6/N4//index.php/site/articles/does_testosterone_supplement_tribulus_work/P6/N8/
-
Try this in the .htaccess file. It should work fine for sure.
You don't need to manually add your website name.<code class="htaccess" title="in your .htaccess file">RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]</code>
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
-
Redirects, 301's & 404's
I have tons of links that I have had added a redirect to after creating my companies new website. Is it bad to have all these 301s? How do I permanently redirect those links? Also, on Google Search Console it's telling me I have 1,000+ excluded links. Is this bad? Will it negatively affect me? Is this something to do with my sitemap? Any help would be greatly appreciated 🙂
Technical SEO | | sammecooper0 -
How long for a sitewide 301 to reindex?
Hey Gang, Finally joined the big boys here, excited to see what we all can do together. Here is my situation. I have been struggling since panda 1.0 on a particular site at www.burnworld.com. Over 2011 we figured out what the issues were with the content and went on a major cleanup. This seemed to help towards the end of the 2011. However further panda updates this year mainly April have again struck. This was after adding a wordpress blog to the site late 2011, so it was a mix of a traditional html site and a wordpress blog. Thinking that this could be an issue in May this year we transferred all the content over to wordpress only. We did keep the same linking strucutre using a permallink plugin to set specific url's. Forward to Panda 20. This wiped out all rankings and then we could not even rank for our own content. One site that syndicates our content is now ranking for our content instead of us, and many 'feed' sites that scrape out feeds also rank insead of us. Okay now to my original question. 2 weeks ago we pulled the plug and made the decision it may be best to start over on www.burnworld.net since the .net in the past was a blog on wordpress (which was shutdown earlier n 2012), but sat with about 5 pages of content until we did the 301. So today none of the pages are in the main index and I am wondering if doing the 301 might have been a mistake by pointing it to an existing site that never really ranked. Would it have been best to start on a new domain? How long have others seen before google puts the pages back in the main index? Would like to figure out the best action to take to get back into google's good graces. I'll keep this page updated so others with this issue can hopefully have a resource to turn to. BTW- nothing has chaned with Binghoo, rankings are all the same and they have updated the domain change properly.
Technical SEO | | robdawg0 -
Www & non-www URL Issue
Hi is there any tools out there which can enable me to find pages which both serve www and non-www versions of each URL
Technical SEO | | monster990 -
Summarize your question.Sitemap blocking or not blocking that is the question?
Hi from wet & overcast wetherby UK 😞 Ones question is this... " Is the sitemap plus boxes blocking bots ie they cant pass on this page http://www.langleys.com/Site-Map.aspx " Its just the + boxes that concern me, i remeber reading somewherte javascript nav can be toxic. Is there a way to test javascript nav set ups and see if they block bots or not? Thanks in advance 🙂
Technical SEO | | Nightwing0 -
Prestashop, language and 301
Hello, A question about Prestashop: I noticed that there are some Prestashop websites, with only one language, that work with a redirection from the main domain (for exemple, www.domain-name.com) with a 301 redirection to the main language url (for example, www.domain-name.com/fr ) Here is an example: http://prestaplayers.com/fr/ Assuming that French is the only language on that website, and knowing that links are generally made to www.domain-name.com (and not to www.domain-name.com/fr) I assume that some netlinking juice is lost for no reason, due to the 301 redirect ? In this case, and if the website exists for some years, what should be done ? Change all the urls because of that problem ? Or maybe change the stronger links to make them point to the real address (www.domain-name.com/fr) ? Thank you in advance for yout help dans suggestions !
Technical SEO | | Spleen0 -
On-Page Question
Im trying to increase value to specific pages by putting history, and additional images. Will copying snippets from other sites negatively affect me? Should the content be re-written completely?
Technical SEO | | Anest0 -
Magento URL Question
Calling all Magento Kings out there! I'm working on a client' site - powered by magento. I'm looking to rewrite a lot of the URLs. I know there is the URL rewrite tool, but I think what I need to do may go beyond this. Typical example would be: Old URL - http://www.xxxxxxxx.co.uk/fabric/product/product-black-screen-print-and-silver-fabric.html New URL - http://www.xxxxxx.co.uk/fabric/product/silver I know that magento's URLs seem to be created through categories so wanted to double check with someone the best way to do this. Also, I've heard that 301 redirects of non www to www in the .htaccess has a knock on effect on discounts? All comments greatly appreciated.
Technical SEO | | PerchDigital0 -
.htaccess and www - non www
Recently I have taken over a website and I made a pretty colossal mistake. The site was properly constructed via .htaccess to a www domain. Typically I roll without it and I made a bad assumption that the .htaccess was not previously set correctly because there were hundreds of fundamental mistakes. After a couple of days I noticed the mistake but some of our new (non www) have picked up some solid links etc. So now I feel that I am in a nightmare of creating redirects etc. So should I switch back to WWW or not? Does it matter at this point?
Technical SEO | | mikeusry0