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. Intermediate & Advanced SEO
    4. How do i redirect www.domain.com/ to www.domain.com/index.php

    How do i redirect www.domain.com/ to www.domain.com/index.php

    Intermediate & Advanced SEO
    3 3 1.3k
    • 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.
    • mattmillen
      mattmillen last edited by

      I keep getting in my analytics www.domain.com/ and www.domain.com/index.php how do i make it consistently redirect to one version and not to both.

      I know about htaccess redirect and am already using this so am puzzle to which is the best one to use.

      below is the example .htaccess file im using.

      Options +FollowSymlinks
      RewriteEngine on
      rewritecond %{http_host} ^domain.co.uk [nc]
      rewriterule ^(.*)$ http://www.domain.co.uk/index.php$1 [r=301,nc]

      which is better for SEO should i forward to www.domain.com/ or www.domain.com/index.php

      1 Reply Last reply Reply Quote 0
      • imageworks-261290
        imageworks-261290 last edited by

        use the rel="canonical" tag I believe http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394

        1 Reply Last reply Reply Quote 0
        • Dr-Pete
          Dr-Pete last edited by

          I'd actually do it the other way - redirect "index.php" to the root ("/") version - Google seems to prefer that and many of your inbound links will be to the root domain (people naturally default to it). Make sure your internal links point to that ("/") as well. See this post that expands on that and gives some .htaccess examples:

          http://www.searchmasters.co.nz/articles/78/redirecting-indexphp-to-root-using-htaccess/

          You can add the canonical tag to help sweep up the problem, but I think it's best to have a solid 301-redirect in place here, especially if both versions are showing up in analytics.

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          • Putting my content under domain.com/content, or under related categories: domain.com/bikes/content ?
            Andy.Drinkwater
            Andy.Drinkwater
            0
            2
            69

          • Something happened within the last 2 weeks on our WordPress-hosted site that created "duplicates" by counting www.company.com/example and company.com/example (without the 'www.') as separate pages. Any idea what could have happened, and how to fix it?
            Christy-Correll
            Christy-Correll
            0
            6
            161

          • How to 301 Redirect /page.php to /page, after a RewriteRule has already made /page.php accessible by /page (Getting errors)
            DirkC
            DirkC
            0
            2
            435

          • Domain.com/postname vs. Domain.com/blog/postname
            Mark_Ginsberg
            Mark_Ginsberg
            0
            7
            222

          • Which is better /section/ or section/index.php?
            TimHolmes
            TimHolmes
            0
            7
            79

          • Https://www.mywebsite.com/blog/tag/wolf/ setting tag pages as blog corner stone article?
            AlirezaHamidian
            AlirezaHamidian
            0
            6
            135

          • URL Redirect: http://www.example.net/ vs. http://www.example.net
            dotfly
            dotfly
            0
            2
            705

          • Redirecting www.example.com to www.example.com/directory/
            JamieCottle28
            JamieCottle28
            0
            3
            1.0k

          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