Support » Fixing WordPress » How to stop WordPress from editing .htaccess?

  • Resolved Sam_a

    (@sam_a)


    I’ve removed WordPress’s Rewrite conditions from my site .htaccess but WordPress (2.0.7) seems to put them back in periodically. I haven’t changed the blog or WordPress URL or the permalink structure.

    On my local server Apache runs as www and I can take away write access, but on this remote server Apache runs as me (the FTP user) so I don’t know what to do.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Set the permissions of it to 444? Then nobody can write to it.

    Anyway, without the .htaccess stuff, permalinks won’t work. Why would you remove those from there?

    I still need to write to .htaccess though. 🙂

    I’m still using pretty permalinks, but I’m using a modified set of Rewrite conditions to limit which requests WordPress should handle. WordPress doesn’t overwrite these, but it adds the default conditions below, which nullifies what I’m trying to do.

    Thanks for the reply, Otto.

    If the server is running as you, then it has the same permissions you do. So deny yourself permissions to write to it or let the server keep writing to it. If you need to change it later, you can override the permissions back and change it, then deny yourself permissions again.

    But you can’t have it both ways here. You and the server have the same identity, so you have the same permissions.

    If I take away my own write access for the file, can I ever get it back? I thought I would need write access to make any further permission changes.

    The problem is not so much that the server has write permission but that WordPress in particular keeps writing to it… I guess I’ll try to find the relevant WordPress code and comment it out. Not a great solution either.

    Thanks, Otto.

    If I take away my own write access for the file, can I ever get it back? I thought I would need write access to make any further permission changes.

    The permissions of the file entry is not the file itself. The owner of the file can always change permissions on it. You don’t need write permissions to change permissions. That would be silly.

    Oh, I was mixed up. If I were to change the file *owner* I’d never be able to get it back. So I’ll try changing the write permissions. Thanks!

    Sam, could you share how you edited your .htaccess file to limit the requests that WordPress handles? I have been trying to figure out how to have certain folders under my root not be considered permalinks or categories by WordPress and promptly 404’d.

    Thanks!

    I had a similar problem and just 777’d my .htaccess. My permalinks now work. However, am I granting too much acccess and leaving my site open for outsiders?

    I have been trying to figure out how to have certain folders under my root not be considered permalinks or categories by WordPress and promptly 404’d.

    Hi Armen, do you mean that you get WordPress’s 404 page when you try to visit an existing directory? (like /images/ or something)

    I have been trying to figure out how to have certain folders under my root not be considered permalinks or categories by WordPress and promptly 404’d.

    If you look at the default .htaccess file it creates, there’s a RewriteRule that ends with a -d. That rule prevents it from doing exactly what you’re talking about. Existing directories will not get rewritten to WordPress.

    Unless you’re trying to do something like password protect those directories, perhaps? This is a known issue with a solution. 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to stop WordPress from editing .htaccess?’ is closed to new replies.