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. Duplicate content /index.php/ issues

    Duplicate content /index.php/ issues

    Technical SEO Issues
    5 3 867
    • 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.
    • b18turboef
      b18turboef last edited by

      I'm having some duplicate content issues with Google.  I've already got my .htaccess file working just fine as far as I can tell.  Rewriting works great, and by using the site you'd never end up on a page with /index.php.  However I do notice that on ANY page of the site you could add /index.php and get the same page i.e.:

      www.mysite.com/category/article

      and

      www.mysite.com/index.php/category/article

      Would both return the same page.  How can I 301 or something similar all /index.php pages to the non index.php version?  I have no desire for any page on my site to have index.php in it, there is no use to it.  Having quite the hard time figuring this out.

      Again this is basically just for the robots, the URL's the users see are perfect, never had an issue with that.  Just SEOMOZ reporting duplicate content and I've verified that to be true.

      1 Reply Last reply Reply Quote 1
      • ExactNiche.com
        ExactNiche.com last edited by

        Hi Emory,

        Simple solution would be to redirect to root from the index.php using htaccess using the rule below. Lets us know how this works for you

        RewriteRule ^(.*)index.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]

        1 Reply Last reply Reply Quote 1
        • b18turboef
          b18turboef last edited by

          Tried that in many ways, but can't get it working.  Here is a copy of the .htaccess file, what changes would need to be made (clearly input that code):

          Options +FollowSymLinks

          RewriteEngine On

          prevents people from accessing anything with phpMyAdmin

          RewriteRule phpMyAdmin - [F]

          Remove index.php or index.htm/html from URL requests

          #RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index.(php|html?)\ HTTP/
          #RewriteCond %{REQUEST_URI} !^/administrator
          #RewriteRule ^([^/]+/)*index.(html?|php)$ http://www.mysite.com/$1 [R=301,L]

          force canonical www if request is for non-www or has port number etc

          RewriteCond %{HTTP_HOST} !^(www.mysite.com)?$
          RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]

          redirect 301 /home.html http://www.mysite.com/

          RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
          RewriteCond %{QUERY_STRING} base64_encode[^(]([^)]) [OR]
          RewriteCond %{QUERY_STRING} (<|%3C)([^s]s)+cript.(>|%3E) [NC,OR]
          RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
          RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
          RewriteRule .* index.php [F]

          #RewriteBase /
          RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
          RewriteCond %{REQUEST_URI} !^/index.php
          RewriteCond %{REQUEST_URI} (/[^.]|.(php|html?|feed|pdf|raw))$ [NC]
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule .
          index.php [L]

          ThompsonPaul 1 Reply Last reply Reply Quote 0
          • b18turboef
            b18turboef last edited by

            Any ideas/input?

            1 Reply Last reply Reply Quote 0
            • ThompsonPaul
              ThompsonPaul @b18turboef last edited by

              Hey Emory - if that's the default .htaccess file your software created (assume this is a Joomla-based site?), it looks like the redirect code you need is already there, but it is disabled by default.

              The following code

              Remove index.php or index.htm/html from URL requests

              #RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index.(php|html?)\ HTTP/
              #RewriteCond %{REQUEST_URI} !^/administrator
              #RewriteRule ^([^/]+/)*index.(html?|php)$ http://www.mysite.com/$1 [R=301,L]

              should do what you want, The reason its not currently doing anything is because it has been commented out. The "#" symbol at the beginning of each line tells the server NOT to run the code in that line.

              Try removing the "#" symbol in front of the last three lines of that code, save the file & then thoroughly test your site. (It's not the way I would write it, but there may be specific requirements for your site/system) The first line is just a descriptive header, so the "#" symbol needs to be left on it.

              If for any reason it causes problems, you can simply re-add the "#" symbols and re-save to return the site to its original state.

              Give that a shot and let us know if it accomplishes what you want to do.

              Paul

              P.S. In particular when testing - ensure that client logins work correctly, and that the search function and all plugins also still work.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Sudden Indexation of "Index of /wp-content/uploads/"
                Tom3_15
                Tom3_15
                0
                4
                192

              • When is Duplicate Content Duplicate Content
                AMHC
                AMHC
                0
                6
                169

              • Duplicate content or Duplicate page issue?
                Kurt_Steinbrueck
                Kurt_Steinbrueck
                0
                2
                106

              • Modx revolution- getting around index.php vs. root duplicate content issue?
                G2W
                G2W
                0
                5
                517

              • Duplicate content issue with trailing / ?
                donford
                donford
                0
                7
                461

              • 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