Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 955913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:27:44+00:00 2026-05-16T00:27:44+00:00

I understand how to ban an IPs address from my apache webserver using .htaccess:

  • 0

I understand how to ban an IPs address from my apache webserver using .htaccess:

order allow,deny
deny from 192.168.44.201
deny from 224.39.163.12
deny from 172.16.7.92
allow from all

I’d like to create a custom “You’ve been banned” page. How could I do this?

EDIT:

To clarify, I am not trying to create a custom 403 page, as these are used in other instances as well (i.e. failed basic authentication, etc). The closest I have come so far is:

rewritecond %{REMOTE_ADDR} ^127\.0\.0\.1$
RewriteRule !^banned$ /banned [NC,L]

but this produces an internal server error when the IP is matched, instead of sending the user to /banned

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:27:45+00:00Added an answer on May 16, 2026 at 12:27 am

    The other answers which suggest an ErrorDocument for the 403 code would be the usual way to do this. But since you want to show a different error page if the user is denied access based on IP (as opposed to other reasons), you can use mod_rewrite, as you suspected.

    RewriteCond %{REMOTE_ADDR} =192.168.44.201 [OR]
    RewriteCond %{REMOTE_ADDR} =224.39.163.12 [OR]
    RewriteCond %{REMOTE_ADDR} =172.16.7.92
    RewriteRule !^/banned.html /banned.html [L]
    

    P.S. This should go in your virtual host configuration, not an .htaccess file, if at all possible. If you don’t have access to the virtual host configuration file, you could put it in a .htaccess file, but remove the leading slash from the RewriteRule pattern (so !^/banned.html becomes !^banned.html).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that in order to return a string from a function I have
I understand pre-order, in-order, and post-order tree traversal algorithms just fine. ( Reference ).
I understand that the system may kill the activity without calling onDestroy(). Say I
I understand the difference between a Mock and a Stub. But different types of
I understand that every time I type the string literal , the same String
I understand that JavaScript isn't really made to open and save files. The best
I understand HTML5 off-line mode is not supported in Internet Explorer 8. Do we
I understand there is a method send for xmlHttpRequest objects, but I've been working
I understand the difference in behavior . Date() returns a String representing the current
In Model-View-Presenter what is the correct pattern to do a page that: a) contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.