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. 301 for "index.php" in Web.config?

    301 for "index.php" in Web.config?

    Technical SEO Issues
    6 3 2.8k
    • 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.
    • tdsnet
      tdsnet last edited by

      Hi there, I'm trying to create a 301 redirect for the file "index.php" but I keep getting a "fail to redirect" message in Firefox whenever I insert it into the Web.config file.

      <location path="index.php"></location>

      Is there anyway around this? Thanks for any help

      According to Open Site Explorer, there are about 500 links to my index file but it only has a 302 status so will not be passing link juice.

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

         <configuration><location path="index.php"></location></configuration> 
        

        Did you add the configuration part?

        Is your home page available on the / part of your domain? Or is it only accessible via index.php? What CMS are you using?

        tdsnet 1 Reply Last reply Reply Quote 0
        • tdsnet
          tdsnet @YannickVeys last edited by

          Thanks Yannick,

          I'm using the configuration tag and there isn't a CMS being used. The page is accessible via index.php, but I'm currently redirecting it using a PHP script (this is fine but it doesn't provide a 301 redirect).

          I'd hopefully like to replace this using the web.config file but it only results in an internal server error or an infinite loop.

          Thanks again.

          YannickVeys 1 Reply Last reply Reply Quote 0
          • YannickVeys
            YannickVeys @tdsnet last edited by

            Did you add/activate all the right plugins/dll files?

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

              Yannick seems to have it right, but here is another way

              <system.webserver><rewrite><rules><rule name="DefaultRule" stopprocessing="true"><match url="^index.php"><action type="Redirect" url="/"  =""></action></match></rule></rules></rewrite></system.webserver>

              tdsnet 1 Reply Last reply Reply Quote 1
              • tdsnet
                tdsnet @AlanMosley last edited by

                Hi Alan,

                Thanks for that, it worked perfectly!

                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

                • Canonical vs 301 for index.php
                  GastonRiera
                  GastonRiera
                  0
                  4
                  205

                • Index.php and 301 redirect with Joomla
                  SanketPatel
                  SanketPatel
                  0
                  2
                  2.1k

                • 301 Redirect Question for trailing slash & index.php
                  anoopbal
                  anoopbal
                  0
                  3
                  973

                • How to block "print" pages from indexing
                  NakulGoyal
                  NakulGoyal
                  0
                  23
                  4.5k

                • Should we use "and" or "&"?
                  IPROdigital
                  IPROdigital
                  0
                  9
                  3.2k

                • Should I use a "-", ":", or "|" in the title tag?
                  CPU
                  CPU
                  0
                  3
                  826

                • Does 301 redirect pass "freshness?"
                  KeriMorgret
                  KeriMorgret
                  0
                  4
                  1.2k

                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