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
-
Website URL, Robots.txt and Google Search Console (www. vs non www.)
Hi MOZ Community,
Technical SEO | | Badiuzz
I would like to request your kind assistance on domain URLs - www. VS non www. Recently, my team have moved to a new website where a 301 Redirection has been done. Original URL : https://www.example.com.my/ (with www.) New URL : https://example.com.my/ (without www.) Our current robots.txt sitemap : https://www.example.com.my/sitemap.xml (with www.)
Our Google Search Console property : https://www.example.com.my/ (with www.) Question:
1. How/Should I standardize these so that Google crawler can effectively crawl my website?
2. Do I have to change back my website URLs to (with www.) or I just need to update my robots.txt?
3. How can I update my Google Search Console property to reflect accordingly (without www.), because I cannot see the options in the dashboard.
4. Is there any to dos such as Canonicalization needed, or should I wait for Google to automatically detect and change it, especially in GSC property? Really appreciate your kind assistance. Thank you,
Badiuzz0 -
Schema address question
I have a website that has a contact us page... of course and on that page I have schema info pointing out the address and a few other points of data. I also have the address to the business location in the footer on every page. Would it be wiser to point to the schema address data on the footer instead of the contact page? And are there any best practices when it comes down to how many times you can point to the same data, and on which pages? So should I have schema address on the contact us page and the footer of that page, that would be twice, which could seem spammy. Haven't been able to find much best practices info on schema out there. Thanks, Cy
Technical SEO | | Nola5040 -
301 redirect or 302
A client of mine has an international company named www.taxglobalizers.com if you come from Holland they 302 redirect you to the www.taxglobalizers.com/en version of the site and if you come from Holland they redirect with a 302 to www.taxglobalizers.com/nl version. I think it is best to change this in a 301 redirect. Am i correct in this? Kind Regards, Ruud
Technical SEO | | RuudHeijnen0 -
Google SERPs and NoIndex directives.
We have pages that have been added to robots.txt as url patterns in DisAllow. Also, we have the meta noindex tags on the pages themselves. But we are finding the pages in index. I don't think they are higher up in the rankings and they don't have any descriptions, any previews or any cached pages. Why does Google show these pages? Could it be due to internal or external linking?
Technical SEO | | gaganc0 -
Frustrating Local Seo Question
I have just lost the top stop on Google Places (Pack 7) for one of my clients. The company that took it came out of nowhere to take the top stop. Now I don't mind getting out ranked when someone has worked hard to out rank me but what is frustrating is this site scores terrible across the board on just about every score that is supposed to determine on and off page ranking factors. The only place it outscores is in the link department but the site is so new there is no data available in OSE. The site has 0's and 1's for PA, MR and MT plus the keyword (kitchen remodeling) that it is taking the top spot for scores and F in the SEOMoz on page report card while the page that I optimized for this very same keyword scores an A. Plus this site has zero citations according to Bright Local Data. What Gives? Here is a little bit of data: Keyword: Kitchen Remodeling My Clients website is http://www.tandmkitchens.com Competitors website: http://www.njkitchendesigns.com I'm kicking his butt in every category except Domain Age and inbound link total, his inbound link total is 409 but it's only from 2 domains.
Technical SEO | | fun52dig
Any thoughts on how this is possible would be greatly appreciated. Thanks all and Merry Christmas!
Gary1 -
Parameter Handling - Nourls Question
We're trying to make sense of Google's new parameter handling options and I seem unable to find a good answer to an issue regarding the NoUrl option. For ex. we have two Urls pointing to the same content: http://www.propertyshark.com/mason/ny/New-York-City/Maps/Manhattan-Apartment-Sales-Map?zoom=1&x=0.518&y=0.3965 http://www.propertyshark.com/mason/ny/New-York-City/Maps/Manhattan-Apartment-Sales-Map?zoom=2&x=0.518&y=0.3965 Ideally, I would want Google to index only the main Url without any parameters, so http://www.propertyshark.com/mason/ny/New-York-City/Maps/Manhattan-Apartment-Sales-Map To do this, I would set the value No Urls for the zoom, x and y parameters. By doing this do we still get any SEO value from back links that point to the URLs with the parameters, or will Google just ignore them?
Technical SEO | | propertyshark0 -
301 redirect issues
Hi all, I'm hoping someone will be able to help me with an extermley frustrating problem with 301 redirects in .htaccess. Basically I'm trying to redirect some old pages (from our old website) that stil rank to the new equivilent. For example - old url = www.domain.com/frames/news/company-news/news-reader.php?newsStoryID=395 New www.domain.com/news/article-title I've tried the simple redirect 301 /frames/news/company-news/news-reader.php?newsStoryID=395 http://www.domain.com/news/article-title But this doesnt work. I've also tried - RewriteEngine on
Technical SEO | | EclipseLegal
RewriteCond %{QUERY_STRING} ^newsStoryID=395$
RewriteRule ^/news-reader.php$ http://www.domain.com/news/article-title/? [L,R=301] Could anyone help? I've followed lots of tutorials that all match the above but it just doesn't work! The only other thing within the htaccess file is from wordpress for pretty permalinks - BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress Many thanks in advance!0 -
Expired traffic and 301 value
Hi Folks, Here is our situation we have an old brand domain www.asia-hotels.com >> that was redirecting to>>www.asiahotels.com By mistake, we let that domain expired and only noticed the drop a month later We lost all our pages and this for several weeks Not sure of the exact date but approximately around 24th of December, what a merry Xmas! 😞 Since then we have repurchased the domain, Put back all the pages as they were and re-instated all the 301 redirect as they were. Since that date we haven't seen any uplift in our visits or visibility score. Did we do something wrong with our 301 redirect? I know for sure we used ISAPI rewrite mod for the non www. domain although I am not entirely sure how the www. version has been handled. Is there something we should do at a DNS level to flag the site is back? Should we presetn a reconsideration request? Any help would be greatly welcomed. Thanks for your help. Cheers, Freddy More info I placed a bit more info and the visits graph on my blog: http://www.inmarketingwetrust.com.au/seo-effect-of-domain-expiry-on-301-redirects/ I am not sure if this is due to the fact that some information is cached but when i looked at the site on opensiteexplorer I found that the data is still showing as non redirected sites: http://www.opensiteexplorer.org/asia-hotels.com/www.asia-hotels.com/a!comparison effect-of-301-redirect-expired-on-SERP-visibility-300x204.jpg
Technical SEO | | Gus_Martin0