Skip to main content
Participant
July 15, 2019
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

    12 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.

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

    so didn't message #2 answer your question ?

    Translate
    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 ##

    Translate
    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 ?

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    July 15, 2019

    For 6 lines of code?

    Why not simply remove the code?

    Translate
    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)

    Translate
    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,

    ^ _ ^

    Translate