TransWikia.com

Is there a way to make htaccess return a blank page on a matching URL?

Stack Overflow Asked by Dan Goodspeed on January 7, 2021

There’s a plug-in on my site that seems to keep trying to access a random unneeded "file.min.map" at whatever location the URL is at, causing a 404 response on my server. There’s not much I can do to stop it, but if I could add an htaccess exception for it somehow to just return a blank page (save bandwidth, no errors, etc), that would be good enough for my needs. Is there an easy way to do that?

And for example, if the user tries to go domain.com/path/url/ , the page will try to load domain.com/path/url/file.min.map and give an error in the console.

One Answer

Create a blank file right under website root directory called blank.html and use this rule in your root .htacess:

RewriteEngine On

RewriteRule (^|/)file.min.map$ /blank.html [L,NC]

This will present /blank.html for every request that ends with file.min.map.


If you cannot create a blank file for some reason then use this in .htaccess:

ErrorDocument 206 "<html></html>"

RewriteEngine On

RewriteRule (^|/)file.min.map$ - [L,NC,R=206]

Answered by anubhava on January 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP