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
-
Www or https only
All pages are secure on my website now. Some of my pages listed on Google are now https://domain.com and some are https://www.domain.com Which format should I use and why? (with www or without?) I want to give Google a new site map URL in the Google search console? Yes I know both URLs go to the same page.
Technical SEO | | Audio-Bible1 -
Canonical Page Question
Hi, I have a question relation to Canonical pages That i need clearing up. I am not sure that my bigcommere website is correctly configured and just wanted clarification from someone in the know. Take this page for example https://www.fishingtackleshop.com.au/barra-lures/ Canonical link is https://www.fishingtackleshop.com.au/barra-lures/ The Rel="next" link is https://www.fishingtackleshop.com.au/barra-lures/?sort=bestselling&page=2 and this page has a canonical tag as rel='canonical' href='https://www.fishingtackleshop.com.au/barra-lures/?page=2' /> Is this correct as above and working as it should or should the canonical tag for the second (pagination page) https://www.fishingtackleshop.com.au/barra-lures/?page=2 in our source code be saying rel='canonical' href='https://www.fishingtackleshop.com.au/barra-lures/' />
Technical SEO | | oceanstorm0 -
Question on canonicals
hi community let's say i have to 2 e-commerce sites selling the same English books in different currencies - one of the site serves the UK market ( users can purchase in sterling) while another one European markets ( user can purchase in euro). Sites are identical. SEO wise, while the "European" site homepage has a good ranking across major search engines in europe, product pages do not rank very well at all. Since site is a .com too it s hard to push it in local search engines. I would like then to push one of the sites across all search engines,tackling duplicate content etc.Geotargeting would make the rest. I would like to add canonicals tag pointing at the UK version across all EU site product pages, while leaving the EU homepage rank. I have 2 doubts though: is it ok to have canonical tags pointing at an external site. is it ok to have part of a site with canonical tags, while other parts are left ranking?
Technical SEO | | Mrlocicero0 -
My www. domain has less page authroity than my non www.
I have a webmaster working on the site and I don't really remember how it got this way but it now appears that the non www have more PA than the www. I am redirecting it so I guess it's a good thing? should I move the site so that it's the root and www is the redirect? any help is greatly appreciated!
Technical SEO | | ecb090 -
301 Redirect - Technical Question
I have recently updated a site and for the url's that had changed or were not transferring I set up 301 redirects in the htaccess file as follows This one works - Redirect 301 /industry-sectors http://www.tornadowire.co.uk/fencing But this one doesn't - Redirect 301 /industry-sectors/equine http://www.tornadowire.co.uk/fencing/application/equestrian/ What it does is change the url to this instead http://www.tornadowire.co.uk/fencing/equine ..... which returns a 404 page not found error The server is nginx based server and we have moved from a joomal platform to a wordpress platform I would be grateful for any ideas
Technical SEO | | paulie650 -
Canonical and 301
Hi We have recently restructured our site and 301 redirected some pages. Unfortunately the new page which we 301 to, still had the canonical tags pointing to the old pages. Would this cause google not to index the new pages....?????
Technical SEO | | jj34340 -
301 redirecting a mobile site.
Is it possible to selectively 301 redirect mobile/tablet user agents and google robots from the desktop version of a website to a mobile site? Would this preserve the SEO for the desktop website while optimizing the mobile/tablet site for mobile SEO?
Technical SEO | | inc.com0 -
Redirect questions
Hi! A client of mine have created a new site with a new URL structure which they launched the other day. They have done a 301 redirect on all pages on the old site to the start page on the new site. E.g:
Technical SEO | | lojdqvist
www.olddomain.com/subfolder1/index.html -> www.newdomain.com
www.olddomain.com/subfolder2/index.html -> www.newdomain.com I'm thinking of fixing this now so the redirect instead looks someting like this:
www.olddomain.com/subfolder1/index.html -> www.newdomain.com/newsubfolder1/index.html
www.olddomain.com/subfolder1/index.html -> www.newdomain.com/newsubfolder1/index.html Two questions: 1. Is it worth doing the latter kind of redirect in all cases (after all, it involves quite a lot more work compared to the first solution)? or do you recommend the first solution for all redirect projects?
2. Now that they have already done the first solution, is it at all worth amending this to the latter or is everything spoiled now that they have already gone ahead with the first solution? Many thanks in advance!0