• majorAlexa

        See all notifications

        Skip to content
        Moz logo Menu open Menu close
        • Products
          • Moz Pro
          • Moz Pro Home
          • Moz Local
          • Moz Local Home
          • STAT
          • Moz API
          • Moz API Home
          • Compare SEO Products
          • Moz Data
        • Free SEO Tools
          • Domain Analysis
          • Keyword Explorer
          • Link Explorer
          • Competitive Research
          • MozBar
          • More Free SEO Tools
        • Learn SEO
          • Beginner's Guide to SEO
          • SEO Learning Center
          • Moz Academy
          • MozCon
          • Webinars, Whitepapers, & Guides
        • Blog
        • Why Moz
          • Digital Marketers
          • Agency Solutions
          • Enterprise Solutions
          • Small Business Solutions
          • The Moz Story
          • New Releases
        • Log in
        • Log out
        • Products
          • Moz Pro

            Your all-in-one suite of SEO essentials.

          • Moz Local

            Raise your local SEO visibility with complete local SEO management.

          • STAT

            SERP tracking and analytics for enterprise SEO experts.

          • Moz API

            Power your SEO with our index of over 44 trillion links.

          • Compare SEO Products

            See which Moz SEO solution best meets your business needs.

          • Moz Data

            Power your SEO strategy & AI models with custom data solutions.

          Let your business shine with Listings AI
          Moz Local

          Let your business shine with Listings AI

          Learn more
        • Free SEO Tools
          • Domain Analysis

            Get top competitive SEO metrics like DA, top pages and more.

          • Keyword Explorer

            Find traffic-driving keywords with our 1.25 billion+ keyword index.

          • Link Explorer

            Explore over 40 trillion links for powerful backlink data.

          • Competitive Research

            Uncover valuable insights on your organic search competitors.

          • MozBar

            See top SEO metrics for free as you browse the web.

          • More Free SEO Tools

            Explore all the free SEO tools Moz has to offer.

          NEW Keyword Suggestions by Topic
          Moz Pro

          NEW Keyword Suggestions by Topic

          Learn more
        • Learn SEO
          • Beginner's Guide to SEO

            The #1 most popular introduction to SEO, trusted by millions.

          • SEO Learning Center

            Broaden your knowledge with SEO resources for all skill levels.

          • On-Demand Webinars

            Learn modern SEO best practices from industry experts.

          • How-To Guides

            Step-by-step guides to search success from the authority on SEO.

          • Moz Academy

            Upskill and get certified with on-demand courses & certifications.

          • MozCon

            Save on Early Bird tickets and join us in London or New York City

          Unlock flexible pricing & new endpoints
          Moz API

          Unlock flexible pricing & new endpoints

          Find your plan
        • Blog
        • Why Moz
          • Digital Marketers

            Simplify SEO tasks to save time and grow your traffic.

          • Small Business Solutions

            Uncover insights to make smarter marketing decisions in less time.

          • Agency Solutions

            Earn & keep valuable clients with unparalleled data & insights.

          • Enterprise Solutions

            Gain a competitive edge in the ever-changing world of search.

          • The Moz Story

            Moz was the first & remains the most trusted SEO company.

          • New Releases

            Get the scoop on the latest and greatest from Moz.

          Surface actionable competitive intel
          New Feature

          Surface actionable competitive intel

          Learn More
        • Log in
          • Moz Pro
          • Moz Local
          • Moz Local Dashboard
          • Moz API
          • Moz API Dashboard
          • Moz Academy
        • Avatar
          • Moz Home
          • Notifications
          • Account & Billing
          • Manage Users
          • Community Profile
          • My Q&A
          • My Videos
          • Log Out

        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. Home
        2. SEO Tactics
        3. Technical SEO
        4. Correct linking to the /index of a site and subfolders: what's the best practice? link to: domain.com/ or domain.com/index.html ?

        Moz Q&A is closed.

        After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

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

        Technical SEO
        3
        4
        1872
        Loading More Posts
        • Watching

          Notify me of new replies.
          Show question in unread.

        • Not Watching

          Do not notify me of new replies.
          Show question in unread if category is not ignored.

        • Ignoring

          Do not notify me of new replies.
          Do not show question in unread.

        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as question
        Locked
        This topic has been deleted. Only users with question management privileges can see it.
        • inlinear
          inlinear last edited by

          Dear all,

          starting with my .htaccess file:

          RewriteEngine On
          RewriteCond %{HTTP_HOST} ^www.inlinear.com$ [NC]
          RewriteRule ^(.*)$ http://inlinear.com/$1 [R=301,L]

          RewriteCond %{THE_REQUEST} ^./index.html 
          RewriteRule ^(.
          )index.html$ http://inlinear.com/ [R=301,L]

          1. I redirect all URL-requests with www. to the non www-version...
          2. all requests with "index.html" will be redirected to "domain.com/"

          My questions are:

          A) When linking from a page to my frontpage (home) the best practice is?: "http://domain.com/" the best and NOT: "http://domain.com/index.php"

          B) When linking to the index of a subfolder "http://domain.com/products/index.php" I should link also to: "http://domain.com/products/" and not put also the index.php..., right?

          C) When I define the canonical ULR, should I also define it just: "http://domain.com/products/" or in this case I should link to the definite file: "http://domain.com/products**/index.php**"

          Is A) B) the best practice? and C) ?

          Thanks for all replies! 🙂
          Holger

          1 Reply Last reply Reply Quote 0
          • CleverPhD
            CleverPhD @inlinear last edited by

            I think you have it correct there.  I always like to end in a slash for index pages

            http://inlinear.com/ - this is your home index page

            http://inlinear.com/products/ - this is your index page for the /products/ folder/group

            http://inlinear.com/products/page.php - this is a page within the /products/folder/group.

            Hardly anyone ever sets up index web pages like index.php or index.htm anymore, they are really not needed as they just make the URL longer. End in the slash and make sure that you are consistent with ending with that slash (vs dropping it off) when you link to your index pages.

            You would need to test the script you mention that rewrites the URL.  It looks like it is making sure that the index page ends in a slash, but I could be wrong.

            Side story -  I have had a CMS that uses  http://inlinear.com/products as the index page for  http://inlinear.com/products/ and this creates all kinds of issues

            1. Most people are used to not having an index page and the URL simply ending in a slash.  So even if you had a non slashed version as your index page, people would link to the slash and then you have to setup 301s to fix that.  Otherwise you end up with all kinds of duplicate page issues.

            2. I know Google Analytics looks at the slashes to group your content into reports.

            So the example index page of  http://inlinear.com/products

            would NOT be included in reports with all the pages in the /products/ group

            e.g. http://inlinear.com/products/page.php

            http://inlinear.com/products/anotherpage.php

            as /products is not "within" /products/  You then have a report on /products/ that leaves out the index page and this is normally your most important page!

            Good luck!

            1 Reply Last reply Reply Quote 0
            • inlinear
              inlinear @rhutchings last edited by

              Thank you, but in practice how does it work without file-extension?

              As I understood its fine if I put the following link to link on my homepage-index:

              http://inlinear.com/     <--- without anything...

              As well when I link to the products page:

              http://inlinear.com/products/ <--- again without anything (index.php)

              But in case of a specific page for example in the products-folder:

              http://inlinear.com/products/my-product-1.php     <--- how can I live without extension?

              I googled and found this .htaccess code. Seems it takes away .php and ads a "/"... is this the best practice?:

              Options +FollowSymLinks -MultiViews

              Turn mod_rewrite on

              RewriteEngine On
              RewriteBase /

              Adding a trailing slash

              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_URI} !/$
              RewriteRule . %{REQUEST_URI}/ [L,R=301]

              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME}.php -f
              RewriteRule ^(.*?)/?$ /$1.php [L]

              Is this what you mean?

              CleverPhD 1 Reply Last reply Reply Quote 0
              • rhutchings
                rhutchings last edited by

                Best practice for all three cases is to never use the file extensions.  You should never link to the file extension names, and make sure in your htaccess file that you dont use the file extensions for any reason moving forward.  Why?

                1. Lets say you decide to re-do your site and it goes from PHP to another language like ASP or something.  You would have to redirect your entire site with file extensions and would shoot yourself in the foot with SEO, traffic and anything else.  By not using file extensions, you give yourself the flexibility down the road and you can maintain a constant url structure.

                2. Indexing may or may not use the file extensions depending on your htaccess/server settings.  You would then essentially be running into duplicate content pages and issues, and thereby negatively affecting your site.  Plus, it will dilute your individual page authority.

                As a side note, just be consistent with your internal linking.  Whether you use relative links or not - some discussion can be had around that.  But pick a route and go with it, just as long as you dont use the file extensions 🙂

                inlinear 1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post

                Browse Questions

                Explore more categories

                • Moz Tools

                  Chat with the community about the Moz tools.

                • SEO Tactics

                  Discuss the SEO process with fellow marketers

                • Community

                  Discuss industry events, jobs, and news!

                • Digital Marketing

                  Chat about tactics outside of SEO

                • Research & Trends

                  Dive into research and trends in the search industry.

                • Support

                  Connect on product support and feature requests.

                • See all categories

                Related Questions

                • SS.Digital

                  Google Indexed a version of my site w/ MX record subdomain

                  We're doing a site audit and found "internal" links to a page in search console that appear to be from a subdomain of our site based on our MX record.  We use Google Mail internally.  The links ultimately redirect to our correct preferred subdomain "www", but I am concerned as to why this is happening and if it can have any negative SEO implications. Example of one of the links: Links aspmx3.googlemail.com.sullivansolarpower.com/about/solar-power-blog/daniel-sullivan/renewable-energy-and-electric-cars-are-not-political-footballs I did a site operator search, site:aspmx3.googlemail.com.sullivansolarpower.com on google and it returns several results.

                  Technical SEO | | SS.Digital
                  0
                • RodneyRiley

                  What's the best way to handle product filter URLs?

                  I've been researching and can't find a clear cut answer. Imagine you have a product category page e.g. domain/jeans You've a lot of options as to how to filter the results domain/jeans?=ladies,skinny,pink,10 or domain/jeans/ladies-skinny-pink-10 or domain/jeans/ladies/skinny?=pink,10 And in this how do you handle titles, breadcrumbs etc. Is the a way you prefer to handle filters and why do you do it that way? I'm trying to make my mind up as some very big names handle this differently e.g. http://www.next.co.uk/shop/gender-women-category-jeans/colour-pink-fit-skinny-size-10r VS https://www.matalan.co.uk/womens/shop-by-category/jeans?utf8=✓&[facet_filter][meta.tertiary_category][Skinny]=on&[facet_filter][variants.meta.size][Size+10]=on&[facet_filter][meta.master_colour][Midwash]=on&[facet_filter][min_current_price][gte]=6.0&[facet_filter][min_current_price][lte]=18.0&per=36&sort=

                  Technical SEO | | RodneyRiley
                  0
                • UnbounceVan

                  How can I stop a tracking link from being indexed while still passing link equity?

                  I have a marketing campaign landing page and it uses a tracking URL to track clicks. The tracking links look something like this: http://this-is-the-origin-url.com/clkn/http/destination-url.com/ The problem is that Google is indexing these links as pages in the SERPs. Of course when they get indexed and then clicked, they show a 400 error because the /clkn/ link doesn't represent an actual page with content on it. The tracking link is set up to instantly 301 redirect to http://destination-url.com. Right now my dev team has blocked these links from crawlers by adding   Disallow: /clkn/   in the robots.txt file, however, this blocks the flow of link equity to the destination page. How can I stop these links from being indexed without blocking the flow of link equity to the destination URL?

                  Technical SEO | | UnbounceVan
                  0
                • blrs12

                  Good alternatives to Xenu's Link Sleuth and AuditMyPc.com Sitemap Generator

                  I am working on scraping title tags from websites with 1-5 million pages. Xenu's Link Sleuth seems to be the best option for this, at this point. Sitemap Generator from AuditMyPc.com seems to be working too, but it starts handing up, when a sitemap file, the tools is working on,becomes too large. So basically, the second one looks like it wont be good for websites of this size. I know that Scrapebox can scrape title tags from list of url, but this is not needed, since this comes with both of the above mentioned tools. I know about DeepCrawl.com also, but this one is paid, and it would be very expensive with this amount of pages and websites too (5 million ulrs is $1750 per month, I could get a better deal on multiple websites, but this obvioulsy does not make sense to me, it needs to be free, more or less). Seo Spider from Screaming Frog is not good for large websites. So, in general, what is the best way to work on something like this, also time efficient. Are there any other options for this? Thanks.

                  Technical SEO | | blrs12
                  0
                • RoxBrock

                  Do I use /es/, /mx/ or /es-mx/ for my Spanish site for Mexico only

                  I currently have the Spanish version of my site under myurl.com/es/ When I was at Pubcon in Vegas last year a panel reviewed my site and said the Spanish version should be in /mx/ rather than /es/ since es is for Spain only and my site is for Mexico only. Today while trying to find information on the web I found /es-mx/ as a possibility. I am changing my site and was planning to change to /mx/ but want confirmation on the correct way to do this. Does anyone have a link to Google documentation that will tell me for sure what to use here? The documentation I read led me to the /es/ but I cannot find that now.

                  Technical SEO | | RoxBrock
                  0
                • Dan-Lawrence

                  Staging & Development areas should be not indexable (i.e. no followed/no index in meta robots etc)

                  Hi I take it if theres a staging or development area on a subdomain for a site, who's content is hence usually duplicate then this should not be indexable i.e. (no-indexed & nofollowed in metarobots) ? In order to prevent dupe content probs as well as non project related people seeing work in progress or finding accidentally in search engine listings ? Also if theres no such info in meta robots is there any other way it may have been made non-indexable, or at least dupe content prob removed by canonicalising the page to the equivalent page on the live site ? In the case in question i am finding it listed in serps when i search for the staging/dev area url, so i presume this needs urgent attention ? Cheers Dan

                  Technical SEO | | Dan-Lawrence
                  0
                • JohnHuynh

                  How to remove all sandbox test site link indexed by google?

                  When develop site, I have a test domain is sandbox.abc.com, this site contents are same as abc.com. But, now I search site:sandbox.abc.com and aware of content duplicate with main site abc.com My question is how to remove all this link from goolge. p/s: I have just add robots.txt to sandbox and disallow all pages. Thanks,

                  Technical SEO | | JohnHuynh
                  0
                • Clicksjim

                  WordPress - How to stop both http:// and https:// pages being indexed?

                  Just published a static page 2 days ago on WordPress site but noticed that Google has indexed both http:// and https:// url's. Usually I only get http:// indexed though. Could anyone please explain why this may have happened and how I can fix? Thanks!

                  Technical SEO | | Clicksjim
                  1

                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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                • Accessibility
                • Terms of Use
                • Privacy

                Looks like your connection to Moz was lost, please wait while we try to reconnect.