DEV Community

Quick and dirty .htaccess for small personal sites

jess unrein on October 29, 2018

I host my personal site on a shared Dreamhost instance. I like it because it's relatively inexpensive, I have low traffic, and I'm not doing anythi...
Collapse
 
tux0r profile image
tux0r

If you're attracting a lot of traffic and/or having difficulties with high load on your server, you probably should move to a VPS where you have root access and use the main server configuration.

And you probably should move away from the Apache web server which does not scale well - and then you won't have a .htaccess file anyway.

Collapse
 
thejessleigh profile image
jess unrein

Definitely, if you're working on a project where web server performance is very important, rather than just a dinky link dump like my personal site, Apache is probably something you should move on from. But I'm assuming that if you're working on that kind of scaling problem, you're not looking to fix small problems here and there with an .htaccess file.

Collapse
 
bpropelled profile image
Propelled • Edited

What would you recommend moving away from Apache to?

PS. Really great article. Thanks for putting this together. I found it helpful and I am sure so many more will too.

Thread Thread
 
thejessleigh profile image
jess unrein

NGINX (pronounced "engine x") has a more robust feature set for dynamic content and is more performant at scale.

There are definitely pros and cons to each solution, and the amount you "feel" the difference between them will largely depend on how complex your site is and what your scaling needs are.

Here's a good side by side comparison from the beginning of this year, if you're trying to decide which solution is right for you.

Thread Thread
 
carlymho profile image
Carly Ho 🌈

Okay, I definitely learned something today, because I had no clue how NGINX was pronounced, haha

Collapse
 
papamike54 profile image
Mike

I am trying to convert dirty URLs (pages.php?id=2) to a clean URL (pages/2) and I have been able to do that but I am getting "Page not found" errors. This is what I am using now (RewriteRule ^([a-zA-Z0-9]+)/$ pages.php?page=$1). Does anyone have a better solution? I have been all over the web looking for a fix but haven't found anything that works.

Collapse
 
thejessleigh profile image
jess unrein

It's been a bit since I've looked at this, but I can try to see if I can find you problem later today. Let me know if you arrive at a solution before I do!

Collapse
 
guntbert profile image
Guntbert Reiter

I really like how you provide a view of the surroundings of any command you use - what it is about, why you would use it (or not), the specifics of parameters....