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
-
Redirect chains error on the home page URL
Hello Everyone, I'm getting redirect chains error on the home page URL:
On-Page Optimization | | Nikhil_Falcon
http://ebitdacatalyst.com in Wordpress. I've checked my redirection list in the plugin, and haven't found any redirections on http://ebitdacatalyst.com. Can anyone please help me in solving this issue? I don't know where from it's coming.0 -
Alot of 302 Redirects, what to do?
I'm currently auditing my companies website, and we encountered thousands of 302 redirects. The 302 pages are products page, which is a question and answer module at the bottom of each products page. What best practice should I do to get rid of the 302 redirects? add those pages to the .robots.txt? Or do individually and add a no index? This would help boost our rankings up correct?
On-Page Optimization | | petmkt0 -
SERP Hijacking/Content Theft/ 302 Redirect?
Sorry for the second post, thought this should have it's own. Here is the problem I am facing amongst many others. Let's take the search term "Air Jordan Release Dates 2017" and place it into Google Search. Here is a link:
On-Page Optimization | | SneakerFiles
https://www.google.com/#q=air+jordan+release+dates+2017 Towards the bottom of the page, you will see a website that has SneakerFiles (my website) in the title. The exact title is: Air Jordan Release Dates 2016, 2017 | SneakerFiles - Osce Now, this is my content, but not my website. For some reason, Google thinks this is my site. If you click on the link in search, it automatically redirects you to another page (maybe 302 redirect), but in the cache you can see it's mine:
http://webcache.googleusercontent.com/search?q=cache:qrVEUDE1t48J:www.osce.gob.pe/take_p_firm.asp%3F+&cd=8&hl=en&ct=clnk&gl=us I have blocked the websites IP, disallowed my style.css to be used so it just shows a links without the style, still nothing. I have submitted multiple google spam reports as well as feedback from search. At times, my page will return to the search but it gets replaced by this website. I even filed a DMCA with Google, they declined it. I reached out to their Host and Domain register multiple times, never got a response. The sad part about this, it's happening for other keywords, for example if you search "KD 9 Colorways", the first result is for my website but on another domain name (my website does rank 3rd for a different Tag page). The page I worked hard on keeping up to date. I did notice this bit of javascript from the cloaked/hacked/serp hijacking website: I disabled iFrames...(think this helps) so not sure how they are doing this. Any help would be greatly appreciated. Note: I am using Wordpress if that means anything.0 -
Help with Temporary Redirects on Pages
Hi Guys, My latest crawl shows this: "44% of site pages served 302 redirects during the last crawl" When I click this to investigate the issue I see: URL:
On-Page Optimization | | jeeyer
https://www.....
https://www.....
https://www.....
https://www.....
https://www..... And under Redirect URL:
http://www....
http://www....
http://www.... I've recently read an article from Yoast that this is a https:// to http:// redirect (ofcourse 😉 ).
but why is this an issue that needs to be solved and how do I solved it? Thanks again for your help and thoughts. Joost0 -
How to redirect subdomain to new blog directory
I have moved my wordpress blog from a subdomain to a subdirectory /blog/ on my site. What is the best way to setup a redirect from the subdomain to the new /blog/ directory? Or should I just delete the subdomain blog and wait for google to index it on /blog/. I need to do one or the other so as not to run into duplicate content issues.
On-Page Optimization | | SamCUK0 -
Redirecting deleted posts 301 vs 302
There is a category on WP where job ads are posted. when a post got deleted I would like to pass 404 error page and redirect all those deleted posts to specific category. I found WP plugin Auto Redirect 404 in 301 for Trashed Posts which does redirect deleted post to specific URL. But posts which are in the trash (not permanently deleted) will get 302 redirects. Those deleted permanently will get 301 redirects. Should I try editing this plugin or find another why? Maybe there is similar way with Redirection plugin?
On-Page Optimization | | OVJ0 -
Redirecting to an exact match root domain: good, bad, or neutral?
We have a client who wants to secure an exact match domain for their new website, but it's very long. They're wondering about securing an additional domain that is much shorter for marketing purposes (business cards, email addresses, etc). We would then 301 redirect the short domain to the main domain. Are we going to see negative SEO implications from that?
On-Page Optimization | | MackenzieFogelson1 -
Building content pages, redirecting and linking
Previously the company had created some .HTML content pages around top shoe styles and top manufactures. One or two of these pages used to rank but have been neglected over the page 18 months. I want to build out new content round our top styles / top manufactures and I am wondering if I should use the existing HTML pages or create new pages that use our content management system. The .HTML pages can contain keywords in the URL, using our content management system, all URL’s are www.site.com/content/home/contentid=1234abcd. If we use the .HTML pages all content is managed manually. If we build out 6 to 10 pages, this can become a resource issue and may result in a bad experience for the website visitor. From an SEO perspective, does the benefit of having the keywords in the URL outweigh the manual management hassles? And if not, should we 301 all the HTML pages to the new content pages? And from a linking standpoint, I want these content pages to point to the new version of the top style. From a navigation standpoint, we also want to provide access to all styles from the manufacture. Should we nofollow the links to all styles?
On-Page Optimization | | seorunner0