How to block a URL/path wild card in htaccess?

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
Post Reply
User avatar
Alison V
Registered User
Posts: 24
Joined: Mon Sep 14, 2020 11:50 am

How to block a URL/path wild card in htaccess?

Post by Alison V »

I tried searching for this but came up short. I would like to block a path with a wild card in htaccess. So the path like /somename/* I would like to 403 that path as a wild card so /somename and everything after /somename/* gets blocked.
User avatar
AmigoJack
Registered User
Posts: 6106
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: How to block a URL/path wild card in htaccess?

Post by AmigoJack »

The Apache manual is up and alive: it should be as easy as:

Code: Select all

<Directory "/usr/local/httpd/htdocs/somename/">
  Require all denied
</Directory>
But consider editing httpd.conf directly instead of having multiple .htaccess files for performance reasons.
User avatar
warmweer
Jr. Extension Validator
Posts: 11195
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: How to block a URL/path wild card in htaccess?

Post by warmweer »

AmigoJack wrote: Mon Jan 25, 2021 3:06 am But consider editing httpd.conf directly instead of having multiple .htaccess files for performance reasons.
While you have a point, my impression is
  • not something users with little experience should do (I do it on localhost (with researching) but wouldn't risk it online)
  • many hosts don't allow editing httpd.conf
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: How to block a URL/path wild card in htaccess?

Post by Lumpy Burgertushie »

It would be safe to say that most hosts do not even allow access to that level on the server.


robert
User avatar
Alison V
Registered User
Posts: 24
Joined: Mon Sep 14, 2020 11:50 am

Re: How to block a URL/path wild card in htaccess?

Post by Alison V »

Yeah, this is a shared server, I don't have direct access to Apache. Also, I'm a noob at this stuff and while I could have poured through the manual, it's very hard for me to understand. Also, I need to block a wild card URL, not one URL. So any thing before and after */something/*.
User avatar
KevC
Support Team Member
Support Team Member
Posts: 72329
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: How to block a URL/path wild card in htaccess?

Post by KevC »

What's the bigger picture of what you're trying to do?
If you're trying to protect a particular folder on the server, your host is the best place to ask.
-:|:- Support Request Template -:|:-
Image
"Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb"
Post Reply

Return to “General Discussion”