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.
-
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> -
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/ -
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.
-
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!
-
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).
-
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?