Support » Fixing WordPress » htaccess rewritten after clicking "permalinks" in admin sidebar

  • Resolved FeralReason


    We installed a WP blog on an existing site – similar to many I’ve done: GoDaddy hosting, Linux Apache server, WP 3.5.1. The blog is in a subdirectory “”.

    My original .htaccess file is:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    # END WordPress

    When I log in to admin and simply click on the “Permalinks” link in the left sidebar (without changing anything) the .htaccess file is rewritten to this (took some trial & error to determine this):

    # BEGIN WordPress
    # END WordPress

    After this, trying to access the blog (“”) results in the chrome message “This webpage has a redirect loop”. Also when I try to log in using “” it does not accept my login but issues no error.

    Once I restore the .htaccess file back to its original state, everything runs fine. Though, unfortunately, I obviously cannot change Permalinks settings with this situation 😛

    Tried to recreate this problem on another site I just installed (also 3.5.1) and the problem did not occur.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator kmessinger


    What is the permalink setting you want to run?


    At first I thought actually changing the setting was causing the .htaccess code to be deleted (changing permalinks can cause .htaccess changes) but the puzzle is that the .htaccess file becomes altered before I ever get into the settings. It happens when I click on the “Permalinks” link in the left sidebar. Makes no sense but I ran several trials to confirm it. After each trial I had to go into FTP, edit the .htaccess and put the code back in that was deleted. Correlation at least… whether it’s cause and effect I don’t know 😛

    Moderator kmessinger


    Set the permissions for the htaccess to 444. That way when you change the permalinks you will get a message showing you what you must manually set the htaccess file to.

    kmessinger – Thanks much. Sorry for long delay – I was on vacation.

    I just tried your suggestion. As soon as I click on Common Settings -> PostName (radio button) and then click “Save Changes” it puts me back into the login screen (as before) and will not allow me to log in.

    No message on proper PermaLink settings appears and the .htaccess file is rewritten, deleting all code as before. At this point I can’t even access the blog online until I restore the .htaccess file back to what I described above (also as before). Going back to the main site and clicking on the link to the blog (or trying to access it through its URL) again results in the message “This webpage has a redirect loop”.

    Since this blog is in a subdirectory of the root, I also checked the Root’s .htaccess file. It is identical to my other installations (that work).

    My best theory (at this point) is that setting Permalinks attempts to rewrite the .htaccess file but only goes half way — deleting the contents but not adding the necessary code. However, I have no theory as to why this might be happening.

    Any other suggestions or theories would be welcome !

    Moderator kmessinger


    Have you tried:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the Twenty Eleven theme to rule out any theme-specific problems.

    – resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    – re-uploading all files & folders – except the wp-content folder – from a fresh download of WordPress.

    Thx for the response. I think I’ve solved the problem. Although I haven’t identified the cause, I’ve at least isolated it down to the root directory’s .htaccess. (Recall that I have the Blog located in a subdirectory of the website’s root — so there is a root .htaccess and a /blog/ .htaccess.)

    So (for the benefit of posterity) here is what worked:
    1) Rename the “.htaccess” in the root directory (to something like “.OLDhtaccess”.
    2) Log into the WP admin area and set the Permalinks as desired.
    3) Test (everything works appropriately.)
    4) Rename the “.OLDhtaccess” back to “.htaccess”.

    I haven’t had the time to test the root .htaccess line by line — and it would disrupt the client’s site too much to do so now — I’ll save that for some future opportunity. (The curious thing is that I have two other virtually identical .htaccess files with very similar sites working fine.)

    Didn’t get around to deactivating plugins – altho there is only one active plugin – sharebar. So no plugins (such as SEO plugins) that might play with .htaccess.

    For now I’m marking this as “resolved” tho not fully understood 🙂

    Thx for all the responses!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘htaccess rewritten after clicking "permalinks" in admin sidebar’ is closed to new replies.