Htaccess Issue: URL not resolving properly
-
I am merging a niche site, tshirts.com to another site mainsite.com.
I am using an htaccess file on a linux server, and the homepage of the niche site is being directed to the corresponding category page on the main site (i.e nichesite.com to mainsite.com/niche.html). Everything else is also a page to page redirect.
I have something like this in the htaccess file:
Redirect 301 http://tshirts.com/ http://www.mainsite.com/tshirts.html
Redirect 301 http://tshirts.com/blue.html http://www.lampclick.com/blue-t-shirts.html
Redirect 301 http://tshirts.com/white.html http://www.mainsite.com/white-t-shirts.html
Redirect 301 http://tshirts.com/black-tshirts.html http://www.mainsite.com/bk-t-shirts.htmlWhen I check 301 for lets say http://tshirts.com/blue.html, I get:
http://tshirts.com/blue.html -** 301 Moved Permanently**
http://www.mainsite.com/tshirts.htmlblue.html -** 302 Found**
http:www.mainsite.com/
How do I fix this? Why is everything being appended to minsite/tshirts.html?
I appreciate your help.
-
The problem is the order here. Remember that redirects fire from top down. In this case, you're telling it to redirect the main page, then redirect the secondary page, so what you get is / redirects to http://www.mainsite.com/tshirts.html and then it tries to redirect /blue.html but it's already done the previous redirect, so it tries to append blue.html to this and you end up with what you did, http://www.mainsite.com/tshirts.htmlblue.html
-
Hi there,
Redirects should always be written in a relative to absolute path.
So the .htaccess file for http://tshirts.com/ should contain something like:
Redirect 301 / http://www.mainsite.com/tshirts.html
Redirect 301 /blue.html http://www.lampclick.com/blue-t-shirts.html
Redirect 301 /white.html http://www.mainsite.com/white-t-shirts.html
Redirect 301 /black-tshirts.html http://www.mainsite.com/bk-t-shirts.htmlI think that should solve the issue.
Keszi
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
-
Duplicate content with URLs
Hi all, Do you think that is possible to have duplicate content issues because we provide a unique image with 5 different URLs ? In the HTML code pages, just one URL is provide. It's enough for that Google don't see the other URLs or not ? Example, in this article : http://www.parismatch.com/People/Kim-Kardashian-sa-securite-n-a-pas-de-prix-1092112 The same image is available on: http://cdn-parismatch.ladmedia.fr/var/news/storage/images/paris-match/people/kim-kardashian-sa-securite-n-a-pas-de-prix-1092112/15629236-1-fre-FR/Kim-Kardashian-sa-securite-n-a-pas-de-prix.jpg http://resize-parismatch.ladmedia.fr/img/var/news/storage/images/paris-match/people/kim-kardashian-sa-securite-n-a-pas-de-prix-1092112/15629236-1-fre-FR/Kim-Kardashian-sa-securite-n-a-pas-de-prix.jpg http://resize1-parismatch.ladmedia.fr/img/var/news/storage/images/paris-match/people/kim-kardashian-sa-securite-n-a-pas-de-prix-1092112/15629236-1-fre-FR/Kim-Kardashian-sa-securite-n-a-pas-de-prix.jpg http://resize2-parismatch.ladmedia.fr/img/var/news/storage/images/paris-match/people/kim-kardashian-sa-securite-n-a-pas-de-prix-1092112/15629236-1-fre-FR/Kim-Kardashian-sa-securite-n-a-pas-de-prix.jpg http://resize3-parismatch.ladmedia.fr/img/var/news/storage/images/paris-match/people/kim-kardashian-sa-securite-n-a-pas-de-prix-1092112/15629236-1-fre-FR/Kim-Kardashian-sa-securite-n-a-pas-de-prix.jpg Thank you very much for your help. Julien
Intermediate & Advanced SEO | | Julien.Ferras0 -
Domain.com/old-url to domain.com/new-url
HI, I have to change old url`s to new one, for the same domain and all landing pages will be the same: domain.com/old-url I have to change to: domain.com/new-url All together more than 70.000 url. What is best way to do that? should I use 301st redirect? is it possible to do in code or how? what could you please suggest? Thank you, Edgars
Intermediate & Advanced SEO | | Edzjus3330 -
Removing UpperCase URLs from Indexing
This search - site:www.qjamba.com/online-savings/automotix gives me this result from Google: Automotix online coupons and shopping - Qjamba
Intermediate & Advanced SEO | | friendoffood
https://www.qjamba.com/online-savings/automotix
Online Coupons and Shopping Savings for Automotix. Coupon codes for online discounts on Vehicles & Parts products. and Google tells me there is another one, which is 'very simliar'. When I click to see it I get: Automotix online coupons and shopping - Qjamba
https://www.qjamba.com/online-savings/Automotix
Online Coupons and Shopping Savings for Automotix. Coupon codes for online discounts on Vehicles & Parts products. This is because I recently changed my program to redirect all urls with uppercase in them to lower case, as it appears that all lowercase is strongly recommended. I assume that having 2 indexed urls for the same content dilutes link juice. Can I safely remove all of my UpperCase indexed pages from Google without it affecting the indexing of the lower case urls? And if, so what is the best way -- there are thousands.0 -
GWT url parameter issue/question
Hi Moz community, I'm having an issue with URL parameters in GWT. The tracking taxonomy for my websites is used as either /?izid=... (internal) OR /?dzid=... (external) I put tracking parameters in GWT as izid & dzid, but it hasn't picked up any URLs or examples in regards to these parameters. It's been about 2 months since we've started using this so I want to make sure Google isn't indexing as duplicate content. Side note: any page that uses a tracking parameter automatically adds rel="canonical" to the original page. Could this be the reason that GWT doesn't pick up any URLs for tracking parameters and/or do I not need to worry about adding paramters if I already have the canonical attribute automatically in place. Thanks for your help,
Intermediate & Advanced SEO | | IceIcebaby
-Reed0 -
SEO benefit of tracked URLs
I've found a lot of mixed info on this topic so I thought I'd ask the experts (Moz community). If I'm adding tracking parameters to URLs to monitor organic traffic will this affect the rank/value of the original clean URL? If so, would best practice be to 301 redirect the tracked URL to the original:
Intermediate & Advanced SEO | | IceIcebaby
i.e. redirect www.example.com/category/?DZID=Organic_G_NP/SQ&utm_source=Organic&utm_medium=Google TO www.example.com/category Thanks for your help!
-Reed0 -
Is white text on a white background an issue when...?
Hi guys, This question was loosely answered here (http://www.seomoz.org/q/will-google-index-a-site-with-white-text-will-it-give-it-bad-ratings), but I wanted to elaborate on the concern. The issue I have is this, http://www.searchenginexperts.com.au/preview/white-text-white-background-issue Of the four div elements on the page, which; is best practice for SEO? and which of them would not be penalized by google on the grounds of hidden text? The reason I ask is that I have a site that is currently implementing the first div styling, but if you either remove the image OR uncheck the repeat-x (in inspect element) the text is left as white on white. I have added the transparent image on green to prove that having a background colour to back up the tiled image is not always going to work. What can be done in this scenario? Thanks in advance, Dan (From my managers account)
Intermediate & Advanced SEO | | RuchirP0 -
Duplicate Content Issue
Why do URL with .html or index.php at the end are annoying to the search engine? I heard it can create some duplicate content but I have no idea why? Could someone explain me why is that so? Thank you
Intermediate & Advanced SEO | | Ideas-Money-Art0 -
Changing URLS - wondering about implications
We are in the process of changing our URLs from dynamic to more SEO friendly. The website is ciee.org and I'm specifically talking about ciee.org/study. While we work with the business to get approval for ciee.org/study-abroad, we are going with ciee.org/study/abroad. Can anyone foresee any difficulties or negative implications that could come if we change from study/abroad to study-abroad all within 6 months? Thank you in advance!!
Intermediate & Advanced SEO | | CIEEwebTeam0