Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By jcontraros on
Recently my google webmasters account for my website showed I had duplicate title tags. They were "/" and "/index.php" which are the same page. How can I fix this? If I add index.php to robots.txt will this work? Will it remove my homepage?
Comments
Should be safe to exclude /index.php
As the search engine need not know EXACTLY the filaname of the default page in order to index the "/" URL.
I have used Google Webmaster tools for a long time, never have seen that grip yet.
How did you generate your sitemap file? With the xmlsitemap module?
Yes
Yes I used the XML Sitemap module. I do not see "index.php" on the sitemap though, yet google webmasters shows it. I did not have this problem until today. The other day I made changes to my .htacess file to redirect non-www to www. I think this may have something to do with it? I added index.php to robots and I will see what happens. Thanks.
Probably not the "redirect non-www..."
I am quite familiar with the .htaccess rules to shift the domain name onto the correct domain name. Doubt that is the source of what put Google onto index.php. Perhaps Google picked that tidbit up from a direct link from another site? (shrug)
Thinking further...
I think you should simply do an Apache 301 redirect of /index.php to /
Should be...
This one did it for me. #
This one did it for me.
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
Add it to your .htaccess file after
RewriteBase /
but before the line#Rewrite URLs of the form 'x' to the form 'index.php?q=x'
--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.