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
-
After HTTPS upgrade, should I change all internal links, or a general 301 redirect is better?
I recently upgraded to https. Of course most internal links of my old posts are still http. So I set up a 301 redirect in order to make the old link works. In terms od SEO this is good or it is better to update all the internal links to https, manually? In that case can I do it in batch with a search/replace command in the phmyadmin database? any other suggested method? thank you
On-Page Optimization | | micvitale0 -
Removing & redirecting old pages
Hi In the case of an e-commerce store when you remove/delete an old sub department page because you no longer sell the products that page was for can you/should you redirect it to its parent main category/dept page first or just delete and let become a 404 ? Being a sub department it is obviously closely related to the main category/dept but seem strange to 301 it since its not really moved permanently to that page but i hear that's what people do to transfer that pages authority before deleting it so its not lost cheers dan
On-Page Optimization | | Dan-Lawrence0 -
Boatload of 301 Redirects Question
We have a client that came to us and they recently did a site makeover. Previously they had all their pages in root directory including 75+ spammy article pages. On their makeover, they moved all the article pages into a directory and added 301 redirects. In going over their site we noticed they have redundant articles, like an article on blue-marble-article.htm and blue-marbles-article.htm Playing on singular and plural with dulpicate content for most part with exception to making it plural. If they have 75 articles, Id say 1/3 are actually somewhat original content. I would like to 301 redirect 2/3's of the articles to better re-written article pages but that would add a whole lot more 301 redirects. We would then have a 301 redirect from root directory to article directory, then another 301 redirect from spam article to new re-written article. My question is, would this be too many redirects for googlebot to sort through and would it be too confusing or send bad signals? Or should I create a new directory with all good articles and just redirect the entire old articles directory to the new one? Or just delete the redirects and old spammy directory and let those fall on a 404 error page. Id hate to lose 50-75 pages but I think its in fact those spammy pages that could be why the site fell from top of first page google to third page and now 10th page in a years time. I know, Im confused just typing this out. Hope it makes sense for some good feedback and advise. Thanks.
On-Page Optimization | | anthonytjm0 -
Redirect
Some time ago I have created a category which I have deleted later. Now seomoz is showing me that its not found, obviously...what would be the best practice to redirect this category to a page? I know that with 301, but how, can I do it when I deleted that category:-(
On-Page Optimization | | VillasDiani0 -
301 redirect usage
I just wondering if using a lot of 301 redirects could hurt to my seo? We have site which have a lot of content with such links: title: This Is Title page url: www.site.com/This-Is-Title-page.html and we use for each page 301 redirect to remove capital letters in url: www.site.com/this-is-title-page.html Is this is good idea and not hurting to seo ? Thanks in advance
On-Page Optimization | | bele0 -
Quick Question on Redirects
This might be a silly question, but one important enough for me to ensure that I understand the best practice of URL redirects... I'm thinking of changing my URL's and hierachy of some of my WP subpages around, in order to logically fit the keyword into the url and place the subpage closer to the root domain. My question is, when doing this, can I simply edit the URL and create a redirect after the fact, essentially killing the old URL. Or, do I create the new page with the updated URL and hierarchy, keeping the old page live and intact, but have that 301 redirect to its new corresponding destination? Thanks
On-Page Optimization | | JayAdams320 -
Best way to do a 301 redirect when the incorrect page has rank and FB likes
Due to a site structural problem with our CMS we have alot of duplicate content pages (1 page, with multiple urls). We are in the process of setting up 301 redirects to correct the problem. Meanwhile; one of the pages with the "incorrect" URL happens to be the page google favors and also has about 100 FB "likes". The question is: Are we better off keeping the "incorrect" URL for that particular page and redirect the other url to it? Both have a page rank of 3. Thanks
On-Page Optimization | | foodsleuth0 -
How do you create a 301 redirect for www.mysite..com/index.html in htaccess.
I understand that it is possible to create a 301 redirect for www.mysite..com/index.html to www.mysite.com. (as well as subdirectories.) How is this accomplished? My hosting company says that setting this up in htaccess will cause "Apache to geti into an infinite loop and the page won’t load." I have read on the forum that this is possible. Any help would be greatly appreaciated. THanks. Perri
On-Page Optimization | | PerriCline0