The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Domain.com and domain.com/ redirect(error)

    Domain.com and domain.com/ redirect(error)

    Technical SEO Issues
    8 3 757
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cgman
      cgman last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • donford
        donford last edited by

        After you fixed the issue did you wait till the next report was generated to see if the crawl detected the same error?

        cgman 1 Reply Last reply Reply Quote 0
        • cgman
          cgman @donford last edited by

          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

          donford cgman 3 Replies Last reply Reply Quote 0
          • donford
            donford @cgman last edited by

            Try

            RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/ RewriteRule ^(([^/]+/)*)index\.php$ http://example.com/$1 [R=301,L]

            Ref:

            http://coltoncat.com/apache-redirect-to-root/

            1 Reply Last reply Reply Quote 0
            • cgman
              cgman @cgman last edited by

              That seemed to work somewhat, however the inner page linking broke completely.

              domain.com/sample-page

              ... no longer loads

              1 Reply Last reply Reply Quote 0
              • cgman
                cgman @cgman last edited by

                Anyone have any other ideas?

                1 Reply Last reply Reply Quote 0
                • Cyrus-Shepard
                  Cyrus-Shepard last edited by

                  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.

                  cgman 1 Reply Last reply Reply Quote 1
                  • cgman
                    cgman @Cyrus-Shepard last edited by

                    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]

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    • We switched the domain from www.blog.domain.com to domain.com/blog.
                      Nigel_Carr
                      Nigel_Carr
                      0
                      3
                      170

                    • Redirect /label/ to /tags/
                      Taiger
                      Taiger
                      0
                      3
                      143

                    • Hey all -- ever seen a client with URLs that keep repeating the domain? Something like: client.com/client.com/client.com/subfolder-name. Any idea what glitch could cause that?
                      rjonesx. 0
                      rjonesx. 0
                      0
                      5
                      103

                    • If I want clean up my URLs and take the "www.site.com/page.html" and make it "www.site.com/page" do I need a redirect?
                      Booj
                      Booj
                      0
                      4
                      113

                    • Blog.domain or domain.com/blog
                      Asjad
                      Asjad
                      0
                      7
                      206

                    • What is the SEO Effect of Removing Old 301 Redirects from Domain A.com -> B.com on B.com?
                      AlanMosley
                      AlanMosley
                      0
                      11
                      2.4k

                    • Correct linking to the /index of a site and subfolders: what's the best practice? link to: domain.com/ or domain.com/index.html ?
                      CleverPhD
                      CleverPhD
                      0
                      4
                      245

                    • How to redirect my .com/blog to my server folder /blog ?
                      AymanH
                      AymanH
                      0
                      5
                      149

                    Get started with Moz Pro!

                    Unlock the power of advanced SEO tools and data-driven insights.

                    Start my free trial
                    Products
                    • Moz Pro
                    • Moz Local
                    • Moz API
                    • Moz Data
                    • STAT
                    • Product Updates
                    Moz Solutions
                    • SMB Solutions
                    • Agency Solutions
                    • Enterprise Solutions
                    • Digital Marketers
                    Free SEO Tools
                    • Domain Authority Checker
                    • Link Explorer
                    • Keyword Explorer
                    • Competitive Research
                    • Brand Authority Checker
                    • Local Citation Checker
                    • MozBar Extension
                    • MozCast
                    Resources
                    • Blog
                    • SEO Learning Center
                    • Help Hub
                    • Beginner's Guide to SEO
                    • How-to Guides
                    • Moz Academy
                    • API Docs
                    About Moz
                    • About
                    • Team
                    • Careers
                    • Contact
                    Why Moz
                    • Case Studies
                    • Testimonials
                    Get Involved
                    • Become an Affiliate
                    • MozCon
                    • Webinars
                    • Practical Marketer Series
                    • MozPod
                    Connect with us

                    Contact the Help team

                    Join our newsletter
                    Moz logo
                    © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                    • Accessibility
                    • Terms of Use
                    • Privacy