Prevent directory listing with redirect

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Prevent directory listing with redirect

Post by Exclusive » Mon Nov 12, 2018 11:49 pm

I just discovered that my forum's directory listing wasn't disabled, so I disabled it with redirect using the below code.

Code: Select all

Options -Indexes
ErrorDocument 403 /location/index.php 
Now I would like to redirect it to the phpBB "Page not found" (The requested page could not be found.) file instead, where is this file located?

I mean the phpBB Error page not found (The requested page could not be found.) file??
Last edited by Exclusive on Tue Nov 13, 2018 10:18 am, edited 1 time in total.
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
Lumpy Burgertushie
Registered User
Posts: 65349
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Prevent directory listing with redirect

Post by Lumpy Burgertushie » Tue Nov 13, 2018 12:19 am

what are you trying to do and why?


robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: Prevent directory listing with redirect

Post by Exclusive » Tue Nov 13, 2018 12:24 am

Lumpy Burgertushie wrote:
Tue Nov 13, 2018 12:19 am
what are you trying to do
To redirect anyone trying to list my forum's directory.
Lumpy Burgertushie wrote:
Tue Nov 13, 2018 12:19 am
and why?
For security reasons.
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
Lumpy Burgertushie
Registered User
Posts: 65349
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Prevent directory listing with redirect

Post by Lumpy Burgertushie » Tue Nov 13, 2018 12:45 am

ok, as long as you have a file named index in the forum root, nobody can see the file listing at all.

you can have index.php or index.htm or index.html phpbb comes with index.php only.

you almost never need to make any changes for this to work properly.

if it does what you say then you need to undo whatever you did to the server files and then contact your host to find out why it doesn't work like it should.

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: Prevent directory listing with redirect

Post by Exclusive » Tue Nov 13, 2018 1:09 am

Lumpy Burgertushie wrote:
Tue Nov 13, 2018 12:45 am
ok, as long as you have a file named index in the forum root, nobody can see the file listing at all.

you can have index.php or index.htm or index.html phpbb comes with index.php only.

you almost never need to make any changes for this to work properly.

if it does what you say then you need to undo whatever you did to the server files and then contact your host to find out why it doesn't work like it should.

robert
Please, I just need the location of the "This page cannot be found" file and that's all!
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
KevC
Support Team Member
Support Team Member
Posts: 68482
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Prevent directory listing with redirect

Post by KevC » Tue Nov 13, 2018 9:10 am

phpBB doesn't have one. You need to ask your hosts. This is nothing to do with phpBB support.
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"

User avatar
EA117
Registered User
Posts: 126
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Prevent directory listing with redirect

Post by EA117 » Tue Nov 13, 2018 2:08 pm

Exclusive wrote:
Mon Nov 12, 2018 11:49 pm
Now I would like to redirect it to the phpBB "Page not found" (The requested page could not be found.) file instead, where is this file located?

I mean the phpBB Error page not found (The requested page could not be found.) file??
I presume you're looking for this page: bogus

Which is generated by phpBB whenever the path being redirected through app.php doesn't have a known handler.

It's not a static "page" you can directly link to, and is being generated like any other phpBB page.

But you could literally redirect to https://mydomain.com/bogus and have that page show up. And as long as this path remains invalid the "requested page could not be found" page will be shown, although it might be "weird" to visitors as to where the arbitrarily invalid "bogus" path came from. I might choose to simply redirect them to the "front page" of my forum instead, but that's your call of course.

If you are actually trying to find the Apache/HTTP server's 404 redirect page, and not the one displayed by phpBB using the configured phpBB theme and site information, etc., then yes that's a discussion with your hosting provider as to where their default 404 page is, if they have one.

(edited per request)
Last edited by EA117 on Wed Nov 14, 2018 11:38 am, edited 1 time in total.

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49772
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Prevent directory listing with redirect

Post by stevemaury » Tue Nov 13, 2018 2:50 pm

If you have a blank index.htm file in every folder, as phpBB comes with, all this is unnecessary and increases server load.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

User avatar
EA117
Registered User
Posts: 126
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Prevent directory listing with redirect

Post by EA117 » Tue Nov 13, 2018 3:13 pm

stevemaury wrote:
Tue Nov 13, 2018 2:50 pm
If you have a blank index.htm file in every folder, as phpBB comes with, all this is unnecessary and increases server load.
Definitely not disagreeing. Although it's also very understandable to have a desire to "show them something" rather than "show them nothing." Even the hosting service's 404 page would be undesirable in my opinion, since it carries none of the careful and good-looking theme work otherwise done for the phpBB-based site your visitors are landing on, doesn't have a "board index" or top banner link for getting back to the valid site paths, etc.

I've never used the official "pages" extension to create static pages for phpBB, but I suppose that could be another option instead of leveraging app.php's default error behavior.

And it finally dawned on me much later that "/404" would have been a more logical "intentionally invalid" path to suggest; e.g. https://mydomain.com/404/

(edited per request)
Last edited by EA117 on Wed Nov 14, 2018 11:38 am, edited 1 time in total.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 20390
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Prevent directory listing with redirect

Post by Mick » Wed Nov 14, 2018 8:33 am

You could edit the supplied index.htm file(s) and put an info message in it like "Whoopsy, nothing to see here" or similar.
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.

User avatar
Lumpy Burgertushie
Registered User
Posts: 65349
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Prevent directory listing with redirect

Post by Lumpy Burgertushie » Wed Nov 14, 2018 9:10 am

for the root of the board, there is no index.htm file there is only the index.php file

as long as that file is where it belongs, nobody will ever see your directory listing for the board.
most, if not all, of the rest of the directories have a index.htm file to keep visitors from seeing the directory listing.

you are worrying about a problem that does not exist in the standard phpbb.


robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
KevC
Support Team Member
Support Team Member
Posts: 68482
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Prevent directory listing with redirect

Post by KevC » Wed Nov 14, 2018 9:17 am

And for all of the other directories they will only be able to see the files they can readily download from here and look at for free anyway.
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: Prevent directory listing with redirect

Post by Exclusive » Wed Nov 14, 2018 8:29 pm

Thanks All, Problem solved! EA117, you're the man!
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: Google [Bot], Lumpy Burgertushie and 26 guests