htaccess-validator icon indicating copy to clipboard operation
htaccess-validator copied to clipboard

Servername example.com doesn't exists

Open Mte90 opened this issue 4 years ago • 5 comments
trafficstars

On ubuntu or debian that domain in apache doesn't exist but the validate-htaccess command use it: https://github.com/liquidweb/htaccess-validator/blob/develop/bin/validate-htaccess#L43

Mte90 avatar Feb 17 '21 16:02 Mte90

I did a gist with some modification so don't require anymore composer and support also stdin with install instructions https://gist.github.com/Mte90/c6568811cd38b60cf05f0e9d8f16bc7a

Mte90 avatar Feb 18 '21 16:02 Mte90

@Mte90 Do you happen to have a specific error message you can share? The -C directive explicitly includes a directive before processing the rest of the rule, so the -C "ServerName example.com" is designed to set a default server name in environments where one might not explicitly be set.

#7 also adds Debian support (which I've verified against local Ubuntu VMs), so I'd love your feedback if updating to the version of the script from that PR solves the issues you're seeing.

stevegrunwell avatar Feb 23 '21 19:02 stevegrunwell

Yes, no problem. I am using it on my Debian machine (I use linux everywhere) and also on my VPS. So the new feature of my script are based on the pending pull requests and more stuff:

  • Now supports stdin or a file for htaccess rules
  • A parameter to define the domain where will inject on the fly the new rules, default is example.com
  • Remove RewriteBase rule that can create errors from the file passed to the htaccess
  • In case of htaccess error, print it

I can do a pr with that script but I am already using in production as it is on my gist. I integrated also on a test suites for a tool that generate htaccess stuff we are developing for our customers.

Mte90 avatar Feb 24 '21 14:02 Mte90

I'll dig into the gist further and reconcile those changes with what's already been done in #6 and #7.

I integrated also on a test suites for a tool that generate htaccess stuff we are developing for our customers.

How did you guess why this package was developed? :wink:

stevegrunwell avatar Mar 02 '21 16:03 stevegrunwell

Ahahah yes, we were looking for the same thing.

Mte90 avatar Mar 02 '21 16:03 Mte90