How to Make A Comment in .htaccess

Comments are super important, especially in a large file. They help you remember what a specific chunk of code does, so you, or someone else, are able to quickly understand the file when looking at it on a later date.

So how do you make a comment?

Commenting is super simple, just follow these two rules!

  1. A comment must be on its own line
  2. A comment must start with a pound sign (Or hash character) “#”


Advertisement

TinkerAd

What are some examples?

Example One


ErrorDocument 404 /error/404.html # Hi! I am a super comment!!! ErrorDocument 403 /error/403.html

Example Two


########## #READ ME! ########### ErrorDocument 403 /error/403

What are some invalid examples?

Don't copy this one!

Bad example


ErrorDocument 401 /error/401 ErrorDocument 404 /error/404 #Not here!

Conclusion

That's it! Super simple, but you will thank yourself when it saves you time in the future. Happy coding!

Advertisement

Article by Tinkerman