Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEO - Redirect Homepage or Root URL - Trailing Slash

Does anyone know if Google will punish a site if the homepage (with or without the trailing slash) returns a 200 OK header response?

I have tested tons of sites using an online redirect checker (CNN, NY Times, FOX News, Wikipedia, etc...) and they all return 200 "ok" with or without the trailing slash.

I know all inner pages need to use one or the other, but it appears the homepage is an exception. What do you all think?

PS, I'm using URLRewrite in IIS7 to force www, lowercase, and remove trailing slashes. It seems the homepage is the only page not affected by the trailing slash rule.

For example, using a tool, I checked the following URLs. They are both "Direct Links". Neither is a 301 redirect:

  • https://www.wikipedia.org
  • https://www.wikipedia.org/

Numerous other examples produce the same results.

Here is my URLRewrite code (web.config)

    <rules>
        <rule name="CanonicalHostNameRule1" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^www\.example\.com$" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}" />
        </rule>
        <rule name="LowerCaseRule1" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
            <action type="Redirect" redirectType="Permanent" url="{ToLower:{URL}}" />
        </rule>
        <rule name="Remove trailing slash" stopProcessing="true">
            <match url="(.*)/$" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="{R:1}" />
        </rule>
    </rules>
like image 986
Joe Hakooz Avatar asked Dec 21 '22 19:12

Joe Hakooz


2 Answers

OK, so here is the official answer from the Google Blog

And I quote... "Rest assured that for your root URL specifically, http://example.com is equivalent to http://example.com/ and can’t be redirected even if you’re Chuck Norris."

So there you have it. The root URL is not only safe with or without a trailing slash, but it might even be impossible to 301 redirect one to the other.

like image 58
Joe Hakooz Avatar answered Jan 03 '23 12:01

Joe Hakooz


I would advise maintaining a set style (using one or the other) to prevent directory confusion. There should be no difference on the SEO side whatsoever. Using 301 redirects may be an option in this case if you feel you require it.

like image 29
Daniel Li Avatar answered Jan 03 '23 12:01

Daniel Li