Problemas with my htaccess file
-
Hi all, I have two doamins actived which content is the same. Regarding Google some of you guys told me that I wouldn't be penalized but If I wanted to do a redirection 301 it should be done from one domain to the domain which is my main market. And I just did it. But the problem is that although I have made the corresponding modifications in the htaccess file it doesn' work. When I write www.piensapiensa.com goes to piensapiensa.com (as I configured the WMT) and not to www.piensapiensa.es, in which my market is mainly present. Heres the code for the HTACCESS file:
Options +FollowSymLinks +ExecCGI
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC]
RewriteRule (.*) http://www.piensapiensa.es/$1 [R=301,L]
<ifmodule mod_rewrite.c="">RewriteEngine On# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /# we skip all files with .something
#RewriteCond %{REQUEST_URI} ..+$
#RewriteCond %{REQUEST_URI} !.html$
#RewriteRule .* - [L]# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]</ifmodule>Thanks in advanced.
-
Thanks mememax. I got it now. The problem is that I have only one htaccess file. www.piensapiensa.es and www.piensapiensa.com (the two domains) show the same web there's only one site, one CMS, Wordpress.
Thanks again for your time.
-
Ok, actually having set up the GWT makes google understand which one is the main address but it is not phisically redirected for the other Search Engines.
You'll have two different htaccess files. One in the .com site:
RewriteEngine On
RewriteRule (.*) http://www.piensapiensa.com/$1 [R=301,L]if you have the same url structure. If not:
RewriteEngine On
RewriteRule . http://www.piensapiensa.com [R=301,L]And the other in the .es site:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC]
RewriteRule (.*) http://www.piensapiensa.es/$1 [R=301,L]this will make redirect everything to the www.piensapiensa.es version. HOpe this clarifies you everything. However I really recommend you to have a well trained webmaster doing this for you, because if you don't know how to edit an htaccess you can mess up your whole site.
-
Thanks mememax. I didn't understand well. I have:
www.piensapiensa.es (main market)
http://piensapiensa.es which redirects to www.piensapiensa.es via webmastertools
www.piensapiensa.com which redirects to http://piensapiensa.com via webmastertools.
I want the las three items to redirect to www.piensapiensa.es (unique domain).
What would be the senteces (exactly) in the htaccess file?
Thanks in advance
-
Ok so if all the url are the same you can redirect the .es domain to the same page in the .com with
RewriteRule ^(.*) http://www.piensapiensa.com$1 [R=301,L] (I don't remember if you have a / or not in the rewrite base, so if this doesn't work try adding a / before $1)
If the new site has different pages fro mthe old one and you don't want to maintain them in the new one just redirect everything to the homepage.
RewriteRule . http://www.piensapiensa.com [R=301,L]
-
Thanks mememax for your reply. Sorry 'cause it wasn't so clear. What I want is to redirect the traffic from www.piensapiensa.com to www.piensapiensa.es where the main market of my client is. Should I use the last configuration you wrote in the post?
Thanks again.
-
HI Juan Miguel, I don't understand well. You want to redirect everything to piensapiensa.com isn't that so?
But in your htaccess you're saying to redirect the non www version to the www version of piensapiensa.es
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC]
RewriteRule (.*) http://www.piensapiensa.es/$1 [R=301,L]
What you'll need in your domain is a redirect like
RewriteRule (.*) http://www.piensapiensa.com$1 [R=301,L]
and you're done. if you're sharing server config in the same htacces you can put an
RewriteCond %{HTTP_HOST} piensapiensa.es [NC]
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
-
SVG image files causing multiple title tags on page - SEO issue?
Does anyone have any experience with SVG image files and on-page SEO? A client is using them and it seems they use the title tag in the same way a regular image (JPG/PNG) would use an image ALT tag. I'm concerned that search engines will see the multiple title tags on the page and that this will cause SEO issues. Regular crawlers like Moz flag it as a second title tag, however it's outside the header and in a SVG wrap so the crawlers really should understand that this is a SVG title rather than a second page title. But is this the case? If anyone has experience with this, I'd love to hear about it.
On-Page Optimization | | mrdavidingram2 -
.htaccess redirect chains
At item 4 in the post at http://moz.com/blog/htaccess-file-snippets-for-seos the author recommends combining .htaccess redirects to avoid chaining redirects. I'd be obliged if someone could expand on: 1. What he means by chained redirects 2. How to combine the redirects per his recommendation Cheers.
On-Page Optimization | | ztalk1120 -
How can I fix multiple 404 errors with Wildcard htaccess redirect
Hi all I hope that someone can help.... How can I fix multiple 404 errors with Wildcard htaccess redirect The url in question is: How can I fix multiple 404 errors with Wildcard htaccess redirect http://www.5starweddingdirectory.com/listing/search/Category/luxury_hotels_venues_uk_wedding_venues/exclusive_use_venues/letter/c http://www.5starweddingdirectory.com/listing/location/uk-england/bedfordshire-weddings/franklin-park http://www.5starweddingdirectory.com/deal/location/uk-england/chorley-weddings/curtis-bay etc, going to http://www.5starweddingdirectory.com/business the above is just a few examples, google webmaster is showing over 8.000 404 page not found errors. Thanks in advance.
On-Page Optimization | | Taiger0 -
Our urls for adwords are slightly different from current urls presented on site (weused htaccess to help create shorter urls). How important is it that the adwords url match the sitemap url for keywords on those pages?
Hello, We have dynamic urls that we have made into short urls through htaccess and code manipulation. Some of our adwords urls are different from our page urls - for example a) Latest version of page www.abc.com/x-y-z.html b) Previous version of url www.abc.com/x+y+z.html c) raw original version www.abc.com/yyy/zzz?category=X&Product-code=Y etc etc. Would my ranking for keywords on the page improve if I diligently made all of them the same? They all go to the same page even now, and no 404 errors or anything. Thanks Sam
On-Page Optimization | | samgold0 -
Robots file include sitemap
Hello, I see that google, facebook and moz... have robots.txt include sitemap at the footer.
On-Page Optimization | | JohnHuynh
Eg: http://www.google.com.vn/robots.txt Sitemap: http://www.google.com/sitemaps_webmasters.xml
Sitemap: http://www.google.com/ventures/sitemap_ventures.xml Should I include my sitemap file (sitemap.xml) at the footer of robots.txt and why should do this? Thanks,0 -
What is the importance of image file names and H1, H2 and H3 tags
Hello, My client thinks they will get better rankings if we change the product image names to reflect the keywords for that page, is this true? I believe I just have to add "alt tags" but not sure now. Also, they think its very important to have H1, H2 and H3 tags on each page. I thought this wasn't a big factor anymore. Is it? Thanks
On-Page Optimization | | maximumrank0 -
I have a direct question about file structure.
This question is about a new file structure and SEO friendly URL's. Does a file name make a difference? I have a direct question about file structure. Our old site was formated with a URL of http://rousechamberlin.com/about_us.aspx our new site is structured http://rousechamberlin.com/AboutUs/ no file no extension. As the SEO guy of the company and not the programmer my feeling is this is killing us. Does anybody have any thoughts on this?
On-Page Optimization | | HeadWebChef0 -
Image Optimization - File Name Important?
I am currently working on a site with 100+ recipes that all have image file names that are relevant, but not optimized for keyword purposes. I'm wondering - from an SEO perspective - would it be worth my time to go back through all of the images and rename them with keywords in mind? On my own site I have always done this as a "best practice" but I'm curious - does it make a difference to search engines? Does anyone have any recent research/experiences that they would like to share? Thanks!
On-Page Optimization | | EssEEmily0