Skip to main content
Participant
July 15, 2019
Question

Apply hash tag comments ("#") to .htaccess files

  • July 15, 2019
  • 4 replies
  • 2155 views

Does anyone have a solution to easily comment in/out lines of code in .htaccess files?

Example:

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ -

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php

Change to:

# RewriteEngine On

# RewriteBase /

# RewriteRule ^index\.php$ -

# RewriteCond %{REQUEST_FILENAME} !-f

# RewriteCond %{REQUEST_FILENAME} !-d

# RewriteRule . /index.php

    This topic has been closed for replies.

    4 replies

    Legend
    July 16, 2019

    I think we need nmore info here - you can use various different if and conditional statements in htaccess which might be a way to acheive what you need.

    Paul-M - Community Expert
    B i r n o u
    Legend
    July 17, 2019

    so didn't message #2 answer your question ?

    Nancy OShea
    Community Expert
    Community Expert
    July 15, 2019

    Why can't you manually add hash tags to your .htaccess code in Dreamweaver?

    ## THIS IS A COMMENT ##

    ## THIS IS A COMMENT ##

    ## THIS IS A COMMENT ##

    ## THIS IS A COMMENT ##

    Nancy O'Shea— Product User & Community Expert
    B i r n o u
    Legend
    July 15, 2019

    https://forums.adobe.com/people/Nancy+OShea  a écrit

    Why can't you manually add hash tags to your .htaccess code in Dreamweaver?

    I think that the OP question was to avoid to do it manually on each line step by step... so my previous answer... don't you think ?

    Nancy OShea
    Community Expert
    Community Expert
    July 15, 2019

    For 6 lines of code?

    Why not simply remove the code?

    Nancy O'Shea— Product User & Community Expert
    B i r n o u
    Legend
    July 15, 2019

    your choice,

    search and replace (endline br start line, by a      endline # start line ) you'll still must have the very first line to handle (depending!!)

    or

    us a <IfDefine foo>...</IfDefine> directive block.. as foo won't be declared... all the in between instructions will be avoid... (depending on your apache settings)

    WolfShade
    Legend
    July 15, 2019

    You can do that with any editor.

    https://www.google.com/search?source=hp&ei=2MUsXfyaBojt_Qbz4JbwCg&q=linux+editors&oq=linux+editors&gs_l=psy-ab.3..0l5j0i…

    Keep in mind that if you are in a linux environment you have to open the file with Administrator privileges.  If you are in a Windows environment, you can use NotePad to make the changes.

    V/r,

    ^ _ ^