undefined
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
    • SEO Q&A
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • Case Studies
    • 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.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    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.

    • SEO Q&A

      Insights & discussions from an SEO community of 500,000+.

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • 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.

    • Case Studies

      Explore how Moz drives ROI with a proven track record of success.

    • 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
  • 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
1.9k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • inlinear
    inlinear last edited by Jun 26, 2013, 10:41 AM

    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 Jul 25, 2013, 6:54 PM Jul 25, 2013, 6:54 PM

      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
      • topic:timeago_earlier,29 days
      • inlinear
        inlinear @rhutchings last edited by Jun 26, 2013, 5:26 PM Jun 26, 2013, 5:26 PM

        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 Jul 25, 2013, 6:54 PM Reply Quote 0
        • rhutchings
          rhutchings last edited by Jun 26, 2013, 2:21 PM Jun 26, 2013, 2:21 PM

          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 Jun 26, 2013, 5:26 PM Reply Quote 0
          • 1 / 1
          1 out of 4
          • First post
            1/4
            Last post

          Got a burning SEO question?

          Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


          Start my free trial


          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

          • Breemcc

            Our clients Magento 2 site has lots of obsolete categories. Advice on SEO best practice for setting server level redirects so I can delete them?

            magento nginx

            Our client's Magento website has been running for at least a decade, so has a lot of old legacy categories for Brands they no longer carry. We're looking to trim down the amount of unnecessary URL Redirects in Magento, so my question is: Is there a way that is SEO efficient to setup permanent redirects at a server level (nginx) that Google will crawl to allow us at some point to delete the categories and Magento URL Redirects? If this is a good practice can you at some point then delete the server redirects as google has marked them as permanent?

            Technical SEO | Sep 23, 2023, 10:06 PM | Breemcc
            0
          • znotes

            What's the best way to test Angular JS heavy page for SEO?

            Hi Moz community, Our tech team has recently decided to try switching our product pages to be JavaScript dependent, this includes links, product descriptions and things like breadcrumbs in JS. Given my concerns, they will create a proof of concept with a few product pages in a QA environment so I can test the SEO implications of these changes. They are planning to use Angular 5 client side rendering without any prerendering. I suggested universal but they said the lift was too great, so we're testing to see if this works. I've read a lot of the articles in this guide to all things SEO and JS and am fairly confident in understanding when a site uses JS and how to troubleshoot to make sure everything is getting crawled and indexed. https://sitebulb.com/resources/guides/javascript-seo-resources/ However, I am not sure I'll be able to test the QA pages since they aren't indexable and lives behind a login. I will be able to crawl the page using Screaming Frog but that's generally regarded as what a crawler should be able to crawl and not really what Googlebot will actually be able to crawl and index. Any thoughts on this, is this concern valid? Thanks!

            Technical SEO | Apr 13, 2018, 3:57 PM | znotes
            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 | Apr 3, 2015, 3:14 PM | blrs12
            0
          • RoxBrock

            Is it good practice to still pay for Best of the Web Directory (BOTW) and other similar one's you have to pay for?

            I know that paid for links are hit by Google, but in the past these directories were okay. What about now? Thank you.

            Technical SEO | Oct 28, 2015, 12:33 PM | RoxBrock
            0
          • M_D_Golden_Peak

            How to Remove /feed URLs from Google's Index

            Hey everyone, I have an issue with RSS /feed URLs being indexed by Google for some of our Wordpress sites. Have a look at this Google query, and click to show omitted search results. You'll see we have 500+ /feed URLs indexed by Google, for our many category pages/etc. Here is one of the example URLs: http://www.howdesign.com/design-creativity/fonts-typography/letterforms/attachment/gilhelveticatrade/feed/. Based on this content/code of the XML page, it looks like Wordpress is generating these: <generator>http://wordpress.org/?v=3.5.2</generator> Any idea how to get them out of Google's index without 301 redirecting them? We need the Wordpress-generated RSS feeds to work for various uses. My first two thoughts are trying to work with our Development team to see if we can get a "noindex" meta robots tag on the pages, by they are dynamically-generated pages...so I'm not sure if that will be possible. Or, perhaps we can add a "feed" paramater to GWT "URL Parameters" section...but I don't want to limit Google from crawling these again...I figure I need Google to crawl them and see some code that says to get the pages out of their index...and THEN not crawl the pages anymore. I don't think the "Remove URL" feature in GWT will work, since that tool only removes URLs from the search results, not the actual Google index. FWIW, this site is using the Yoast plugin. We set every page type to "noindex" except for the homepage, Posts, Pages and Categories. We have other sites on Yoast that do not have any /feed URLs indexed by Google at all. Side note, the /robots.txt file was previously blocking crawling of the /feed URLs on this site, which is why you'll see that note in the Google SERPs when you click on the query link given in the first paragraph.

            Technical SEO | Aug 13, 2013, 2:56 PM | M_D_Golden_Peak
            0
          • seekjobs

            Best Practices for adding Dynamic URL's to XML Sitemap

            Hi Guys, I'm working on an ecommerce website with all the product pages using dynamic URL's (we also have a few static pages but there is no issue with them). The products are updated on the site every couple of hours (because we sell out or the special offer expires) and as a result I keep seeing heaps of 404 errors in Google Webmaster tools and am trying to avoid this (if possible). I have already created an XML sitemap for the static pages and am now looking at incorporating the dynamic product pages but am not sure what is the best approach. The URL structure for the products are as follows: http://www.xyz.com/products/product1-is-really-cool
            http://www.xyz.com/products/product2-is-even-cooler
            http://www.xyz.com/products/product3-is-the-coolest Here are 2 approaches I was considering: 1. To just include the dynamic product URLS within the same sitemap as the static URLs using just the following http://www.xyz.com/products/ - This is so spiders have access to the folder the products are in and I don't have to create an automated sitemap for all product OR 2. Create a separate automated sitemap that updates when ever a product is updated and include the change frequency to be hourly - This is so spiders always have as close to be up to date sitemap when they crawl the sitemap I look forward to hearing your thoughts, opinions, suggestions and/or previous experiences with this. Thanks heaps, LW

            Technical SEO | Oct 19, 2012, 7:15 AM | seekjobs
            0
          • TP_Marketing

            .ca and. com domains

            Hello, currently the main site im working on is a .com, but have the .ca version purchased from register.com.  should i have this setup to redirect to the .com site. will google see these as dup content.  We have the .ca for our canadian customers but both sites are identical. Thank you

            Technical SEO | Sep 1, 2012, 1:41 AM | TP_Marketing
            0
          • pauledwards

            .com or .co.uk in UK index? but the .com has higher domain authority...

            Hi there i have a .com and a .co.uk for a site that has been around a while. However not much seo has been done on it, i was wonderign do i continue to optimise for the .com or switch to the .co.uk to rank in Google UK index for various search terms. .COM = 40 domain authority .CO.UK - 10 domain authority. Let the debate start 🙂

            Technical SEO | Dec 20, 2011, 7:13 AM | pauledwards
            0

          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
          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.