RJM62
Touchdown! Greaser!
- Joined
- Jun 15, 2007
- Messages
- 13,157
- Location
- Upstate New York
- Display Name
Display name:
Geek on the Hill
So I was doing some routine checking to see one of my clients' sites was coming up on Google Search. Things looked good: My client was number one.
Until I noticed that Google search, for reasons unknown, had inserted a trailing slash behind the page URL!!! See the screenshot if you don't believe me.
Now what that does to the site is loads the page, but without the stylesheet, because the link is no longer correct. So the page comes up white and inline, with no style elements, like the second screenshot.
Now, if it were just the style problem, it would be easy enough to change the link to the stylesheet to an absolute (rather than a relative) link. But what about all the other stuff that's linked from the pages? None of that would work, either, because all the internal links pointed to imaginary directories.
I quickly did a few more searches, and found that at least one other page had been indexed the same way -- with a trailing slash.
There is nothing on the site (nor its mobile version) that has trailing slashes after the filename that Google could have picked up and indexed, nor do directories with those names exist. Nor does any other search engine that I tried produce this error. Nor do I have any idea whatsoever why it happened.
All I know is that I'm royally pi$$ed.
In the meantime, for at least a day (according to Google's cache), visitors have been seeing those ugly, css-less pages.
Anyway, I kludged out a fix by putting the following in .htaccess:
Which seems to work, although I imagine it'll increase overhead a bit.
What the heck is up with Google lately? From the pi$$-poor CTR and revenue performance of Adsense since they started using user data for ad selection, to their incessant and unrelenting attempts to get my cell phone number by any means necessary (Did you know you can't even view Google+ pages on a mobile device without logging in to your Google account?), to things like this.
They used to be a company I admired. Now I seriously wish they would just go belly-up.
/rant
Okay, thanks. I feel better now.
-Rich
Until I noticed that Google search, for reasons unknown, had inserted a trailing slash behind the page URL!!! See the screenshot if you don't believe me.
Now what that does to the site is loads the page, but without the stylesheet, because the link is no longer correct. So the page comes up white and inline, with no style elements, like the second screenshot.
Now, if it were just the style problem, it would be easy enough to change the link to the stylesheet to an absolute (rather than a relative) link. But what about all the other stuff that's linked from the pages? None of that would work, either, because all the internal links pointed to imaginary directories.
I quickly did a few more searches, and found that at least one other page had been indexed the same way -- with a trailing slash.
There is nothing on the site (nor its mobile version) that has trailing slashes after the filename that Google could have picked up and indexed, nor do directories with those names exist. Nor does any other search engine that I tried produce this error. Nor do I have any idea whatsoever why it happened.
All I know is that I'm royally pi$$ed.
In the meantime, for at least a day (according to Google's cache), visitors have been seeing those ugly, css-less pages.
Anyway, I kludged out a fix by putting the following in .htaccess:
Code:
# Redirect to remove trailing slashes from freaking google search results
# If URL ending with a slash does not resolve to an existing directory
RewriteCond %{REQUEST_FILENAME} !-d
# Externally redirect to remove trailing slash
RewriteRule ^(.+)/$ http://www.[domain].com/$1 [R=301,NC]
What the heck is up with Google lately? From the pi$$-poor CTR and revenue performance of Adsense since they started using user data for ad selection, to their incessant and unrelenting attempts to get my cell phone number by any means necessary (Did you know you can't even view Google+ pages on a mobile device without logging in to your Google account?), to things like this.
They used to be a company I admired. Now I seriously wish they would just go belly-up.
/rant
Okay, thanks. I feel better now.
-Rich
Attachments
Last edited: