this post was submitted on 14 Aug 2025
1 points (100.0% liked)

Web Development

5641 readers
6 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS
 

Hi,

I have this rule in my nginx config file

	location ~* \/(fileA.txt|fileB.txt)$ {
		return 404 'nothing here';
	}

but it's not working

but

	location /fileA.txt {
		return 404 'nothing here';
	}

~~is working....~~

Any idea what's wrong ?

Thanks.

top 7 comments
sorted by: hot top controversial new old
[โ€“] Rick_C137@programming.dev 0 points 9 months ago

Never mind, I understood my mistake... This nginx built didn't come with ngx_http_rewrite_module so return will not works.

[โ€“] elbucho@lemmy.world 0 points 9 months ago (1 children)

You aren't escaping your periods. Try like this:

location ~* \/(fileA|fileB)\.txt$ {
        return 404 'nothing here';
}
[โ€“] Rick_C137@programming.dev 0 points 9 months ago* (last edited 9 months ago) (1 children)

Thanks @elbucho@lemmy.world

I've tried

	location ~* \/(fileA\.txt|fileB\.md)$ {
		return 404 'nothing here';
	}

but still not matching :'(

[โ€“] 30p87@feddit.org 0 points 9 months ago (1 children)
[โ€“] Rick_C137@programming.dev 0 points 9 months ago

.md is correct, it's a test.

[โ€“] x00z@lemmy.world 0 points 9 months ago (1 children)

You might have another location block before it that catches the route.

[โ€“] ramble81@lemmy.zip 0 points 9 months ago

I ran into something similar and the docs didnโ€™t make sense. This link helped figure things out.