Skip to main content
Participant
Jul 15, 2019 6:27 PM UTC
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
    Jul 16, 2019 2:05 AM UTC

    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
    Jul 17, 2019 2:57 AM UTC

    so didn't message #2 answer your question ?

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    Jul 15, 2019 7:09 PM UTC

    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
    Jul 15, 2019 7:13 PM UTC

    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
    Jul 15, 2019 7:24 PM UTC

    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
    Jul 15, 2019 6:36 PM UTC

    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
    Jul 15, 2019 6:30 PM UTC

    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