Solution:
The following is easiest option to avoid these issue.
Step 1: Create the html page as below and upload into document which should be available for the community.
<html>
<head>
</head>
<script>
window.onload = top.location.href = 'ErrorPage'; (Your custom error page or custom landing page)
</script>
<body>
</body>
</html>
Step 2: Add this document in the Community Custom Header (Via community management screen)
This will allows to redirect the user when they manipulating the URL which is valid salesforce URL.
Please check the below link for reference.
- https://developer.salesforce.com/forums/?id=906F00000005GI0IAM
- https://success.salesforce.com/answers?id=90630000000h1IRAAY
hope it helps.Please mark it as best answer if the information is informative.
Thanks
Rahul Kumar