1

One of my clients' sites has been hit by a mass amount of toxic links to "van.php" after there web url.

What I am looking to do is redirect anything with the extension of .php to an 404 page.

e.g

  • domain.com/index.php
  • domain.com/van.php
  • domain.com/anything.php

Is this possible, if so how?

1 Answer 1

1

Put this code in your DOCUMENT_ROOT/.htaccess file:

ErrorDocument 404 /404.php

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[/\s?] [NC]
RewriteRule ^ - [R=404,L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.