.htaccess

Hi, I need some help with .htaccess.

I am trying to get one of my directories only accessible by the staff members of my site, using IP adresses and .htaccess.

It seems to be working, but the errordocument isn’t appearing for the users that aren’t allowed to access, they are just being redirected to http://error404.000webhost.com/?

The ErrorDocument section of my .htaccess file is this:
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

And yes, there are also 403.html and 404.html pages in the public_html folder AND the directory.

Many Thanks
Leates

The same is happening to me I haven’t changed anything .htaccess.

Could a staff member help us?

Any staff members able to help?

How did you create your .htaccess file and put it on the server? Sometimes if it’s not created in a proper (raw) text editor, then it can create problems.

What else is in your .htaccess? Can you post the whole htaccess file (replacing #'s for any “sensitive” information)

Here have a look.

Options -MultiViews +FollowSymlinks -Indexes

If mod_security is enabled, attempt to disable it.

- Note, this will work on the majority of hosts but on

MediaTemple, it is known to cause random Internal Server

errors. For MediaTemple, please remove the block below

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off

</IfModule>

MyBB “search engine friendly” URL rewrites

- Note, for these to work with MyBB please make sure you have

the setting enabled in the Admin CP and you have this file

named .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^forum-([0-9]+).html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+).html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]

RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]

RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]

RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]

RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]

&lt;IfModule mod_env.c&gt;
	SetEnv SEO_SUPPORT 1
&lt;/IfModule&gt;

</IfModule>

If Apache is compiled with built in mod_deflade/GZIP support

then GZIP Javascript, CSS, HTML and XML so they’re sent to

the client faster.

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript text/css text/html text/xml
</IfModule>

Mine was created and is edited in Notepad.

The one in the staff only directory is:

ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

deny, allow

deny from all

allow from #.#.#.#

The one in the public_html folder is

ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

Many Thanks
Leates

Bump Thread

In the staff only directory is there a 403.html and a 404.html file.

Yes, there is.

Anyone that can help?

Apparently this is bumping.

It was not intended, and I find it funny how the moderator just said it was bumping and did not help.

Again, you’re bumping. Please stop.

Try using Notepad++. Notepad (the default one that comes with Windows) has “broken” CR/LFs, which can sometimes cause compatibility issues between unix / win.

Okay, try changing the “deny, allow” line to:
order deny, allow

You don’t need to have separate “ErrorDocument” lines in your subdirectory’s htaccess files, as it’s inherited from above.

See how you go!

drums

The .htaccess file in the directory was edited in Notepad++

This is what it looks like now:

order deny, allow

deny from all

allow from 68.61.164.76

The error page still does not show up.

Are you sure? I can get it to show up.

I don’t get the 403 page when I go to the staff directory though, I get 404 (but 000webhost’s).

drums

What can you get to show up? The site’s 404 page?

That is what I’m trying to solve.

My 404 page works all-over the site, but this just doesn’t seem to be working.

Just the problem again so you understand it: My 403 page won’t show up when someone is denied access into my staff directory. It goes by IPs in the .htaccess file, inside that directory.

Okay… reading back through the posts, should’ve picked this up earlier, but it’s case sensitive…

Try:


Order Deny,Allow
Deny from all
Allow from #.#.#.#

THANKS DRUMS!!!

Are you the most helpful person here?

Lol.

Is the .htaccess in the same directory as the 404 and 403 files