59

Can writing .htaccess files for Web servers be on-topic for Stack Overflow?

  • It can be argued that these are simply configuration files for standard network servers, and so a subject for Server Fault.
  • Alternatively, you can argue that they're a domain-specific language that includes some programming features, such as regular expressions, and therefore suitable for Stack Overflow.

Which Stack Exchange site is appropriate for such questions?

Return to FAQ index

1

6 Answers 6

27

I think they fit both.

I'm not browsing Server Fault (SF) much, but I assume that they are a bit annoyed by the amount of dull .htaccess/RewriteRule questions we are moving over.

And factually .htaccess files do not constitute server configuration. They share the same format and obviously Apache evaluates those files. But semantically they are application configuration data (php_flag short_open_tag and SetEnv LC_ALL it_IT). There are very few server settings (ThreadsPerChild or PidFile) you can factually set via .htaccess. There are quite involving options like nested <Files> and LogFormats or complex authentication modules which certainly belong on SF. But the majority of RewriterRule+RewriteCond inquiries can actually be handled on Stack Overflow.

SF has one interesting page for that topic: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? - but it doesn't quite cover regular expressions. I think it might actually make sense to create a similar reference question on SO, but concentrating on regex syntax and practical examples - which isn't yet covered.

2
  • "I assume that [ServerFault] are a bit annoyed by the amount of dull .htaccess/RewriteRule questions" - .htaccess/RewriteRule questions asked on SF are often closed as duplicates of the catch-all mod_rewrite "guide" (as linked to above), whether they are covered by that "quide" or not. Generally, if you don't have direct access to the server config (in which case you probably wouldn't / shouldn't be using .htaccess anyway) then it's likely considered off-topic on SF. Commented Jun 19, 2017 at 8:27
  • 8
    This answer contains absolutely no justification for why these questions are on-topic for Stack Overflow. It merely explains why they're off-topic for Server Fault (both because it's not server configuration and because Server Fault community grows weary by the amount of questions they get about it). Commented Jan 14, 2023 at 11:00
16

My gut says "belongs on SF", since it's a matter of web server configuration. On the other hand, the rewrite engine is often used for programming purposes in developing web apps; if it can show up in the app requirements, it's at least somewhat programming related.

Add "Mod Rewrite complete befuzzlement" to the list of rewrite questions on SO, mostly because the question comments includes a mini-discussion about this very topic:

Now that I've already given an answer for this, it really belongs on ServerFault. – outis Nov 27 at 8:50

This is a kind of programming so it's OK on stackoverflow. – Kinopiko Nov 27 at 8:56

But it's not programming--it's a configuration issue. There's nothing wrong with the RE. Most importantly, the average SF user is going to be more knowledgeable about this than the average SO user; Antony's more likely to get better help on SF. – outis Nov 27 at 10:06

Maybe, but Serverfault is fairly low-traffic. – Kinopiko Nov 27 at 13:21

5
  • I resent that someone things SF is Low Traffic. Most (read: good) questions don't go un-answered for more than 10 minutes. Commented Jan 1, 2010 at 9:16
  • 3
    And even if SF is low traffic (while Kinopiko asserted it, I don't know how true it is), not using it isn't the solution, using it is. Commented Jan 4, 2010 at 23:46
  • 2
    gray area, as I said in my answer here. Use what's in your job title as the deciding factor. Is it "programmer"? Or something else? Commented Jan 5, 2010 at 0:26
  • Is this still the right advice? In my experience the vast majority of Apache configuration questions are too basic for the typical SF user (and certainly not indicative of coming from a "professional" system administrator), so I tend to mark them better for superuser.com instead. Commented Jan 9, 2017 at 17:04
  • @Alnitak .htaccess-only questions are almost off-topic on SF, since on SF it is assumed you have access to the main server-config (which mostly renders .htaccess redundant). .htaccess questions often get closed as a duplicate of a catch-all question, whether it answers the question or not. If you feel the need to mark the Q for migration, consider migrating to webmasters.stackexchange.com - where it is probably on-topic. .htaccess files are generally application config files that every webmaster must deal with at some point. Commented May 1, 2017 at 19:53
15

A truly gray area. Pick whichever site you think suits your question better, and go with it.

I'd also suggest that if your job title contains the word "programmer", go with Stack Overflow, and if your job title does not, then go with Server Fault.

0
12

I'd argue they're a better fit for webmasters.stackexchange.com ... seems others have had the same thought (see the Q&A Why do we need webmasters.stackexchange when we have Stack Overflow?).

11

If they concern a production environment which is hosted on your (or your company's servers) then they should probably be asked on Server Fault.

If they concern a production environment which is hosted by someone else then they should probably be asked on Webmasters.

If they concern a development environment (i.e on your development machine for testing) then they should probably be asked on Stack Overflow.

Though it is an area that straddles both development (rather than just programming) and system administration.

0
7

Many, but not all, questions are definitely on-topic for Stack Overflow.

Any question about how you get

example.com/users/view/toby/

to redirect to

example.com/index.php?action=view&userid=toby

although asked 1000 times before, is still on-topic.

Questions about how you set up your .htaccess file to prevent access from two particular IP addresses on a Thursday afternoon in February, but only when the user has previously visited on a Friday is probably better off on Webmasters or Server Fault.

is an important part of many programmer's web application and as such is a necessary part of their understanding.

1
  • NB: Any on-topic question which has been asked already is a duplicate, and should still be closed. Commented Jul 18, 2023 at 16:09

You must log in to answer this question.