this post was submitted on 17 Nov 2026
13 points (100.0% liked)

Web Development

5966 readers
24 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 3 years ago
MODERATORS
 

Hey all, rookie dev here!

I want to set up a website example.net which holds all my projects, but I'd also like to have a domain www.project.test which actually points to a single file on my example.net: example.net/project.html I'd also like for project.test/* to return an error at project.test/404 while example.net/* works normally.

basically project.test should be a url specifically for one (or a subset of) html files which live on example.net.

I figured that I can probably achieve this with the .htaccess file on the shared hosting, apache server my website is on. However the copy/pasteable rules I find online don't exactly fit my needs. I have already set up both domains to point to my website, now I'm kind of stuck.. (I only know html/css and some vanilla js at this point)

Could someone point me to useful (possibly beginner friendly) resources, where I could learn to create my own .htaccess rules / where the syntax is explained in detail? Do you have tips on how to approach this idea?

Any help appreciated!

edit: I'm also not familiar with regex yet , if I need an understanding of those aswell to achieve what i want?

top 3 comments
sorted by: hot top controversial new old
[–] somethingsomethingidk@lemmy.world 8 points 12 hours ago (1 children)

I don't really use apache, but to me it would be easier to use virtual hosts. You still leave the DNS A records as they are, just change what the server does when the Host header is a given value.

https://httpd.apache.org/docs/current/vhosts/name-based.html#using

[–] plaeiou@piefed.social 1 points 6 hours ago

TY , this works if I put the files project.example would point to in a subdirectory of the website (I don't seem to have more granular control with my hosting provider). For this project I'd prefer to have no subdirectories though - If I want project.example to point at any single html file/ a group of html files which are located in the main folder of my site I think I'll have to manage with .htaccess

[–] Zachariah@lemmy.world 2 points 15 hours ago