Search code examples
urlseoduplicatesdirectoryindex

SEO - DirectoryIndex duplicate content


On a site I'm working on there will be about 7 different directories. I use DirectoryIndex in my .htaccess to point to index.php, so you can go to site.com/menu/ or site.com/menu/index.php and get the same content and so on for the other 6 directories.

I know duplicate content is supposed to be bad. Will this cause any SEO issues, or will search engines be smart enough to understand it's a DirectoryIndex and only index the result once?


Solution

  • Using DirectoryIndex is a very common practice. If done right it isn't a problem. However it can introduce duplicate content.

    • Pick one to be "canonical". You probably want to use site.com/menu/ as canononical. Who wants to see "index.php" in urls?
    • Never link to the non-canonical version. Instead of href="index.php" use href="./" Users shouln't ever see "index.php" in the url by clicking around the site.
    • If you do that, Googlebot will probably never even know what the real name of the file is and there will be no problem. If Googlebot does start crawling urls with "default.php" in them, then use the canonical tag to tell Google which is the correct url that it should pay attention to.