Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Unsubscribed User
85 PointsHow can you redirect to 404.php from a 403?
Im trying to figure out how to create a htaccess file that is limited to certain IPs that can log into the wp-admin folder. If the IP is not among the list I would like the 403 forbidden to redirect to the 404.php file. However, how do you do this in the htaccess folder?
I did try to create a .htaccess file in the wp-admin directory as:
AuthUserFile /dev/null AuthGroupFile /dev/null AuthName "WordPress Admin Access Control" AuthType Basic <LIMIT GET> order deny,allow deny from all
whitelist Syed's IP address
allow from xx.xx.xx.xxx
whitelist David's IP address
allow from xx.xx.xx.xxx
whitelist Amanda's IP address
allow from xx.xx.xx.xxx
whitelist Muhammad's IP address
allow from xx.xx.xx.xxx
whitelist Work IP address
allow from xx.xx.xx.xxx </LIMIT>
RewriteEngine on ErrorDocument 403 /sitename/404.php
but I get an error message of "This webpage has a redirect loop". I did try to search on StackOverflow and the closes I was able to find was http://stackoverflow.com/questions/15818694/htaccess-not-redirecting-to-404-php-instead-shows-page-name but that didn't cover how to use it with WordPress.
1 Answer

Wayne Priestley
19,579 PointsHi Matthew,
Rather than try to explain, I can point you to a htaccess tutorial site that I learned from, it's not a huge long winded really detailed tutorial, but it worked for what I needed and I think it might be just what your looking for, or at least a good start.
Tutorial 2 May help you out I think.
I hope this helps, let me know how it goes.
Wayne
Unsubscribed User
85 PointsUnsubscribed User
85 Pointsthanks for that.