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. Index.php duplicate content

    Index.php duplicate content

    Technical SEO Issues
    7 3 1.7k
    • 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.
    • klsdnflksdnvl
      klsdnflksdnvl last edited by

      Hi, new here.

      Im looking for some help with htaccess file.

      index.php is showing duplicate content errors with:

      mysite.com/index.php

      mysite.com/

      mysite.com

      ive managed to use the following code to remove the www part of the url:

      IfModule mod_rewrite.c>
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
      RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

      but how can i redirect the mysite.com/index.php and mysite.com/ to mysite.com.

      Please help

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

        <code>## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond%{THE_REQUEST}^[A-Z]{3,}\s([^.]+)\.php [NC]RewriteRule^%1[R,L,NC]</code>
        
        KristinaKledzik 1 Reply Last reply Reply Quote 0
        • KristinaKledzik
          KristinaKledzik @TextMarketing last edited by

          Hey David,

          Just wanted to follow up with you on this - did TextMarketing's method work?

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

            Hi Kristina,

            No unfortunately my question was misunderstood.

            It wasn't the file extension i was looking to hide.

            I was looking to redirect mysite.com/index.php to mysite.com/ or mysite.com via an htaccess file.

            Im currently working through distilled's online course (nice course btw) , I was hoping to get an answer here :http://www.distilled.net/u/technical/#technical-duplicate-content, (Homepage Canonicalization), but i couldnt find one 😞

            This is not a critical question, as im just tinkering around on friends sites, but i would like to learn this.

            Unfortunately my free seomoz trial runs out today and im waiting until I have completed distilled's course's before i renew my moz subscription, so i can make better use of moz  tools, so i may not be able to see your reply.

            Is it cool to tweet @ you?

            KristinaKledzik 1 Reply Last reply Reply Quote 0
            • KristinaKledzik
              KristinaKledzik @klsdnflksdnvl last edited by

              Once your trial runs out, you won't be able to respond, but at least you'll still be able to see my answer!

              I think you can use the .htaccess file redirect command:

              Redirect 301 /location/from/root/file.ext http://www.othersite.com/new/file/location.xyz

              So, it should be:

              Redirect 301 /index.php http://mysite.com

              Redirect 301 / http://mysite.com

              If that doesn't work, here's someone with the same problem on StackExchange.

              P.S. Glad you like the Distilled course. 🙂

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

                Great thankyou so much.

                Also another interesting person to follow on twitter 😄

                KristinaKledzik 1 Reply Last reply Reply Quote 0
                • KristinaKledzik
                  KristinaKledzik @klsdnflksdnvl last edited by

                  Of course! Glad I could help. 🙂

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  • When is Duplicate Content Duplicate Content
                    AMHC
                    AMHC
                    0
                    6
                    169

                  • Duplicate page content - index.html
                    Collie
                    Collie
                    0
                    5
                    1.2k

                  • Duplicate content issue. Delete index.html and replace with www.?
                    Dr-Pete
                    Dr-Pete
                    1
                    13
                    3.0k

                  • Duplicate index.php/webpage pages on website. Help needed!
                    MatthewBarby
                    MatthewBarby
                    0
                    4
                    691

                  • Duplicate content issue index.html vs non index.html
                    KaneJamison
                    KaneJamison
                    0
                    10
                    1.7k

                  • How do I fix Duplicate Content/Title going to memberlist.php page?
                    john4math
                    john4math
                    0
                    2
                    1.3k

                  • High number of Duplicate Page titles and Content related to index.php
                    jfeld222
                    jfeld222
                    0
                    8
                    1.3k

                  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