PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, June 29, 2022

[FIXED] How to comment out whole sections of a .htaccess file?

 June 29, 2022     .htaccess, apache, comments     No comments   

Issue

Is it possible to comment out one or more sections of an .htaccess file, like you would using /* and */ in various programming languages?


Solution

Strictly speaking, .htaccess files only allow single-line comments: an hash character (#) at the beginning of a line lets the parser know that line should be ignored, i.e.:

# this is a comment in an .htaccess file and many other scripting languages

However, from a practical perspective it is possible to wrap any number of contiguous lines in an IF block (available from Apache 2.4). This effectively disables the lines within the block. For example:

<IF "false">
...disabled directives...
</IF>

That been said, a multi-line comment in many programming languages would allow more or less any content within it, i.e. plain english rather than viable code. Conversely, the content of an IF block as mentioned above must be composed of proper .htaccess directives and regular single-line comments - an http 500 error will be generated otherwise.



Answered By - manu3d
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing