Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
281 views
in Technique[技术] by (71.8m points)

apache - return 410 gone for all pages with exceptions

My Wordpress has been hacked and cleaned, but now tens of thousands pages return 404 http code from Googlebot and other search engine witch saturate my hosting and SEO is a disaster.

My web site have only ten pages and i would like send an 410 http code for every urls exept my ten pages (and other stuff like images)

Here where I am

RewriteCond %{REQUEST_URI} !^/$ [OR]
RewriteCond %{REQUEST_URI} !^(.*)nos-prestations(.*)$ [OR]
RewriteCond %{REQUEST_URI} !^(.*)pour-les-entreprises$ [OR]
RewriteCond %{REQUEST_URI} !^(.*)wp-content(.*)$
RewriteRule ^ - [G]

But all pages return 410 Where is my mistake ?

Tanks a lot.

Edit, my legitimates URLs

https://www.kidooland.fr
https://www.kidooland.fr/nos-prestations/
https://www.kidooland.fr/pour-les-entreprises/
https://www.kidooland.fr/arbre-de-noel-entreprises/
https://www.kidooland.fr/le-foot-en-salle/
https://www.kidooland.fr/news/
https://www.kidooland.fr/contact/
https://www.kidooland.fr/kidooland-le-parc/
https://www.kidooland.fr/parents-enfants/
https://www.kidooland.fr/le-foot-en-salle/
https://www.kidooland.fr/tarifs-horaires/
question from:https://stackoverflow.com/questions/65848493/return-410-gone-for-all-pages-with-exceptions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With your shown samples, could you please try following. Please make sure you clear your cache before testing your URLs.

RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(nos-prestations|pour-les-entreprises|arbre-de-noel-entreprises|le-foot-en-salle|news|contact|kidooland-le-parc|kidooland-le-parc|le-foot-en-salle|tarifs-horaires) [NC]
RewriteRule ^ - [G,L]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...