WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Excluding certain file extension in wordpress htaccess code

[Resolved] Excluding certain file extension in wordpress htaccess code

  • The .htaccess code generated by wordpress performs its rewrite action when nor the file nor the directory exists. Ok, but here my problem.

    I don’t always want that to be the case: I have cgi-scripts running that also have to be rewritten. So therefore I would like the wordpress code in the .htaccess to exclude .cgi extensions. I could add an extra exclusion line in the wordpress code, but that code is overwritten by wordpress (when I change my permalink settings for example).

    Does anybody know of a better idea?

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    In your .htaccess file, above your # BEGIN WordPress line put in these lines:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .*\.cgi - [L]
    </IfModule>

    If those CGI files actually exist, then this shouldn’t be necessary. The WordPress additions to .htaccess should not be effecting any file or directory that actually exists; they check if the file or directory exists before engaging the rewrite rule.

    That’s it!

    Jan, you are my hero today.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Excluding certain file extension in wordpress htaccess code’ is closed to new replies.
Skip to toolbar