Support » Fixing WordPress » .htacces resets itself a couple of minutes after upload

  • So, whats up with this?

    I upload my .htacces file and it looks like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^.*\.htm$
    RewriteRule ^([a-z0-9]*)\.htm $1 [L,R=301]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteRule ^([a-z0-9]*)\.htm $1
    </IfModule>
    
    # END WordPress

    And it works fine for a while, then after a couple of minutes it’s back to this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Does wordpress resets the htacces? Do I have to move my added rewrite rules out of the BEGIN and END wordpress “tags”?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Yes and yes. Don’t put your code inside the #BEGIN and #END lines and WordPress won’t touch it. Put your own rules before the WordPress rules.

    Ok, cool, so do I move only the lines with my rewrite rules, like this (btw, doesn’t look right!?) :

    RewriteCond %{REQUEST_URI} ^.*\.htm$
    RewriteRule ^([a-z0-9]*)\.htm $1 [L,R=301]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Or do I need the “starting” things to? Like this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^.*\.htm$
    RewriteRule ^([a-z0-9]*)\.htm $1 [L,R=301]
    </IfModule>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    …or, maybe something else?

    No, like this, right!? 🙂

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} ^.*\.htm$
    RewriteRule ^([a-z0-9]*)\.htm $1 [L,R=301]
    
    # BEGIN WordPress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    # END WordPress
    </IfModule>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘.htacces resets itself a couple of minutes after upload’ is closed to new replies.