Redirection
-
Hi all I have these domains active:
www.piensapiensa.es
http://piensapiensa.es which redirects to www.piensapiensa.es via webmastertools
http://piensapiensa.com
www.piensapiensa.com which redirects to http://piensapiensa.com via webmastertools.
I want the last three items to redirect to www.piensapiensa.esHere is part of the code of the htaccess file that I have until now:
Options +FollowSymLinks +ExecCGI
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC]
RewriteRule (.*) http://www.piensapiensa.es/$1 [R=301,L]Thanks in advanced.
-
Hi Juan Miguel,
For the non-www to www redirects, from http://piensapiensa.es to http://www.piensapiensa.es you can use:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]On the other hand, to redirect: http://piensapiensa.com and http://www.piensapiensa.com to http://www.piensapiensa.es you can use:
RewriteEngine On
RewriteBase /RewriteCond %{HTTP_HOST} ^piensapiensa.com [nc]
RewriteRule ^(.*)$ http://www.piensapiensa.es/$1 [r=301,nc,L]RewriteCond %{HTTP_HOST} ^www.piensapiensa.com [nc]
RewriteRule ^(.*)$ http://www.piensapiensa.es/$1 [r=301,nc,L]Thanks,
Aleyda
-
In theory I think this should work because because the third line is saying "grab all urls that are not htttp://www.piensapiensa.es" and then the 4th says to "change to them to htttp://www.piensapiensa.es"
You have a typo though in line 3 -
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC] should be
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC] (remove the \ between your domain name and the ".es"
As it is now it is not going to do anything for you until you fix that.
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
-
What is the safest way to redirect for best SEO benefits?
What is the safest way to redirect for best SEO benefits? Example: loodgieter-aanhuis.nl -> loodgieters-ambacht.nl Does someone have any technical information on how to (root) redirect for best SEO practices?
On-Page Optimization | | hans-keeren0 -
Redirect and Redirect Error in Moz Crawl
Hello, We have a wordpress blog attached to our magento website located at domain.co.uk/blog/ Moz was coming back showing we had multiple page versions on show (http and https) So i updated the htaccess file to what is below. This has fixed most of the errors, however the homepage is being a little tricky. Moz is now saying that the page is redirecting and redirecting again http://www.domain.co.uk/blog to
On-Page Optimization | | ATP
http://www.domain.co.uk/blog/ to
https://www.domain.co.uk/blog/ BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /blog/</ifmodule> RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L] END WordPress Within wordpress settings the urls are set up as follows Wordpress Address URL: https://www.domain.co.uk/blog Site Address URL: https://www.domain.co.uk/blog i tried to add a trailing / to these but it gets automatically removed. So i am assuming that wordpress is serving up https://www.domain.co.uk/blog **RewriteBase /blog/ **is re-directing it to / then my https rewrite is re-directing it again I am not sure where exactly to fix this, could anybody advise? Many thanks,0 -
Redirect closing established site to another established site.
We have 2 ecommerce websites with duplicate product/category content that have been around for years. "Site A" since 2004 and "Site B" since 2011. "Site B" doesn't generate many sells and we want to close the site in fear that it may look spammy to google and since we don't want to upkeep the site. Couple questions:
On-Page Optimization | | Tuurbo
1. Is it possible that "Site B" has damaged "Site A" with google since they are so similar?
2. Can i 301 redirect all of "Site B" to "Site A" without hurting "Site A"?
3. If question 2 is ok, should i use the "Change of Address" tool in google webmaster tools to point "Site B" to "Site A"? Thanks!0 -
Redirecting pages (old site to new site)
I have a question- there is one location, one set of pages for both the old and new site on the same host environment so when I did the redirect it get into a loop trying to redirect from itself to itself Not sure how its gonna affect SEO. Will pages get hit for duplicate content?
On-Page Optimization | | Yanez0 -
How Much Does a Missing www. 301 redirect hurt a business?
We're preparing a report for a potential client, and are trying to figure out a way to estimate rankings gains. One of the major issues is a lack of a 301 redirect for non-www. domains to www. domains. We checked and there's no canonicalization, so it's a clear issue. According to Google, the non-www. links from 8 different domains. The www. version of the website has links from 248 different domains. Nearly all anchor text is branded, as they've never had any SEO work done before. Does anyone have a suggestion for approximating benefits of setting up their .htaccess file correctly? Would the benefits even be that great? We're of course advising additional things, but we just want to be more certain about this step's SEO-boost.
On-Page Optimization | | FlynnZaiger0 -
How do I do a 301 Redirect in Wordpress
I have several pages that are showing up as "duplicate" on my Wordpress based site based upon the structure of site. I was wondering how to do a 301 redirect for these pages
On-Page Optimization | | SteveSweat0 -
SEOMOZ crawler ignoring redirect?
My crawl report for www.poker-coaching.net show a number of duplicate content warnings.
On-Page Optimization | | CatfishTPA
First, it shows a warning for www.poker-coaching.net and www.poker-coaching.net/, although there is a redirect in place for this, and for non-www. to www. as well. So IMO there is no duplicate content here, so why the error message?
Next, it shows a duplicate content warning for a number of pages, but when I click the number on the right, there is no info an which pages contain the duplicate content. Will this info be there later when the crawl is completed? My problem is that this is my oldest site, but since over one year it seems to have a penalty which I can't get rid of - I cannot identify the reason for the penalty. I already rebuilt the site from scratch once, but I still do not see results. If a membership at SEOMOZ would be able to help me bring this site back on track, that would already be worth one years membership fees, so I'd really be very thankful if someone could take a look at the site and give me an idea about what needs to be done here.0 -
What's the Best Way to Hide Redirects from Search Engines?
Hey everybody, I like to use php redirects for affiliate links so they look better. I keep them all in the same directory. I read recently that these may hurt SEO. A couple quick questions: Is this the best way to redirect affiliate links? Should I simply block the directory in robots.txt? Any other suggestions from you SEO guyses and galz? Thanks! Jared
On-Page Optimization | | JaredB0