Domain.com and domain.com/ redirect(error)
-
When I view my campaign report I'm seeing duplicate content/ meta for mydomain.com and mydomain.com/ (with a slash)
I already applied a 301 redirect as follows:
redirect 301 /index.php/ /index.php
Where am I messing up here?
-
Actually I figured out all of the problems, here is the solution that worked for me:
RewriteEngine On
RewriteBase /#Rewrite bare to www
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
-
Hi Cgman,
There are a couple things you can try here. I assume you're using .htaccess for the redirect? I'm not an expert on these, and they can get messed up pretty quickly, but I'd start by listing the full url in the second instance, like this:
Redirect 301 /index.php/ http://www.example.com/index.php
Another easy way to solve this problem is with a canonical tag. Just make sure both pages have a duplicate canonical tag in the section that points to the same target, like this:
To be honest, although these are technically duplicates you are dealing with, Google has publicly stated that trailing slashes aren't that big of deal, so if you can't invest the time in fixing it, it probably won't hurt you that much.
Hope this helps! Best of luck with your SEO.
-
Anyone have any other ideas?
-
That seemed to work somewhat, however the inner page linking broke completely.
... no longer loads
-
Try
RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/ RewriteRule ^(([^/]+/)*)index\.php$ http://example.com/$1 [R=301,L]
Ref:
-
Yeah I re-crawled it after applying the 301. Here is my full htaccess:
RewriteEngine On
RewriteBase /
#Rewrite bare to www
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]redirect 301 /index.php/ /index.php
Supposed to redirect from nonwww to www, hide .php from pages to look clean: domain.com/category vs domain.com/category.php Then finally redirect index.php/ to index.php
-
After you fixed the issue did you wait till the next report was generated to see if the crawl detected the same error?
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
-
Newbie: .co.uk site redirecting to .com.
If I run a Moz report on the .co.uk site I get a domain authority reading but if I do the same on the .com site there is no authority. How do I get authority passed to the .com (the domain name is the same in both cases)
Technical SEO | | timgtheo0 -
URL Structure On Site - Currently it's domain/product-name NOT domain/category/product name is this bad?
I have a eCommerce site and the site structure is domain/product-name rather than domain/product-category/product-name Do you think this will have a negative impact SEO Wise? I have seen that some of my individual product pages do get better rankings than my categories.
Technical SEO | | the-gate-films0 -
New domain's Sitemap.xml file loaded to old domain - how does this effect SEO?
I have a client who recently changed their domain when they redesigned their site. The client wanted the old site to remain live for existing customers with links to the new domain. I guess as a workaround, the developer loaded the new domain's sitemap.xml file to the old domain. What SEO ramifications would this have if any on the primary (new) domain?
Technical SEO | | julesae0 -
To 301 redirect or not to 301 redirect? duplicate content problem www.domain.com and www.domain.com/en/
Hello, If your website is getting flagged for duplicate content from your main domain www.domain.com and your multilingual english domain www.domain.com/en/ is it wise to 301 redirect the english multilingual website to the main site? Please advise. We've recently installed the joomish component to one of our joomla websites in an effort to streamline a spanish translation of the website. The translation was a success and the new spanish webpages were indexed but unfortunately one of the web developers enabled the english part of the component and some english webpages were also indexed under the multilingual english domain www.domain.com/en/ and that flagged us for duplicate content. I added a 301 redirect to redirect all visitors from the www.domain/en/ webpages to the main www.domain.com/ webpages. But is that the proper way of handling this problem? Please advise.
Technical SEO | | Chris-CA0 -
Redirect Multiple Domains
This is a follow-up question from one posted earlier this month. I can't linked to that because it's a private question so I'm trying to summarize it below. We have a number of domains – about 20 - (e.g. www.propertysharp.com) that point to our main domain ip adress (www.propertyshark.com) and share the same content. This is no black-hat strategy whatsoever, the domains were acquired several years ago in order to help people who mistyped the websites url to reach their desired destination. The question was whether to redirect them to our main domain or not. Pros were the reportedly millions of incoming links from these domains - cons was the fact that lots of issues regarding duplicate content could arise and we actually saw lots of some pages from these domains ranking in the search engines. We were recommended to redirect them, but to take it gradually. I have a simple question - what does gradually mean - one domain per week, per month?
Technical SEO | | propertyshark0 -
Domain Masking with New Keyword-Rich Domains
Hello, friends. We have an ecommerce site and we also own several keyword-rich domains but haven't done anything with them yet. Is there any value in using domain masking to point them to either product pages or special landing pages on our primary ecommerce site? Here's an example: Primary site is widgetzone.com Keyword rich URL is acmewidget.com (which is totally blank and isn't indexed) It could point to our category page for Acme Widgets: widgetzone.com/category/acme-widgets or it could point to a new landing page: widgetzone.com/acme-widgets My concern is that because the keyword-rich URL hasn't been utilized at all there's really no point in redirecting it. I'm of the mind that it's either going to be ineffective at best or a duplicate content issue at worst. What do you guys think? As a follow-up, if we don't redirect these domains, what should we do with them? Just try to sell them off rather than create totally new sites?
Technical SEO | | jbreeden0 -
Keyword domains
Hi everyone. Two questions regarding keyword domains (e.g. "widgets.com") If we have to choose a domain with an extra word, does it make a difference to have the added word before or after? E.g. "my-widgets.com" vs "widgets-now.com" Does it make a difference if the extra word is a generic vs a 'real' word? E.g. "my-widgets.com" vs "japanese-widgets.com" Thanks a lot for your feedback!
Technical SEO | | hectorpn0 -
New website branding, differences between http://www and http://
Hey Mozers! We will be creating another brand pretty soon with some pretty cool interactive features and before we start development of the site I was wondering if there are any pros/cons to branding the site sans the www. For example http://example123.com and http://www.example123.com. I would much prefer to brand it has http://example123.com but I just wanted to check first to see if that would have any negative SEO ramifications. It seems that it might just be a preference as I looked at Facebook and Twitter and they both do it differently, same with Groupon and LivingSocial. Looking forward to hearing from you guys!
Technical SEO | | Riggz1