2

I'm very much a newcomer to Wordpress and to this site, so I apologize if this is easy or addressed elsewhere.

I have a WP 4.0 site, using a naked domain http://example.com, with the WP installation in its own directory /path/public_html/wp. My permalinks are set to use "post name", so the about page has the address http://example.com/about-us, for example. However if anyone were to type in http://example.com/gibberish, they would get my theme's 404 page.

What I would like is to create a directory /path/public_html/other (note: I don't have a page in Wordpress called "Other"), with permissions 755, but hide the fact of other's existence. I want anyone going to http://example.com/other to get the normal Wordpress 404 page as if this directory didn't exist at all.

Of course I realize this is not completely foolproof, and I'm aware of the pitfalls of secret URLs, but if you can, please humor me - any help with creating an .htaccess file for this redirection would be appreciated.

An extremely rough approach would be to just paste the 404 page into an index.php file in the other folder, but of course this would not change as the other content of my site changed, eventually falling out of sync and creating a noticable disparity with the "real" 404 page.

Again, any help would be greatly appreciated, and I'm happy to provide any more information about my installation if necessary.

1 Answer 1

2

If you want to block direct access to the other folder, you can put a .htaccess file in that folder that contains just:

deny from all

That way you cannot open any file from that folder directly, but you can include them (in PHP) without any problems.

1
  • Aha, that works perfectly for my purposes! Thanks for your help!
    – user59818
    Commented Sep 17, 2014 at 3:08

Your Answer

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