steros
steros

Reputation: 1924

410 for specific non-existent subfolders

In Google Webmaster Tools I get a lot of "strange" urls that have a 404. I have no idea where they come from. They always have subfolders that never existed and probably never will. Here are some examples:

https://example.com/{...}/plus.google.com/facebook.com/password-reset.hmlt/register.html https://example.com/{...}/plus.google.com/facebook.com/facebook.com/password-reset.hmlt https://example.com/{...}/plus.google.com/facebook.com/password-reset.hmlt/plus.google.com https://example.com/{...}/register.html/facebook.com/password-reset.hmlt/register.html https://example.com/{...}/password-reset.hmlt/register.html/plus.google.com/password-reset.hmlt

...

It seems its a random mix of these subfolders. How can I produce a 410 for these urls utilising the htaccess file?

Upvotes: 0

Views: 40

Answers (1)

Dusan Bajic
Dusan Bajic

Reputation: 10869

Block if the url contains any of the strings:

RewriteEngine On
RewriteCond %{REQUEST_URI} password-reset|register.html|plus.google.com
RewriteRule ^ - [R=410]

Block if the url contains facebook.com and (plus.google.com or password-reset.hmlt)

RewriteEngine On
RewriteCond %{REQUEST_URI} facebook.com
RewriteCond %{REQUEST_URI} plus.google.com [OR]
RewriteCond %{REQUEST_URI} password-reset.html
RewriteRule ^ - [R=410]

([OR] has higher precedence than the (implicit) [AND])

Upvotes: 1

Related Questions