• I just upgraded from 1.5 to 2.0.4 – it works great except for one thing I’ve noticed…

    I installed it originally in a subdirectory so I could set it up and get it running before moving it to my main directory to replace the older version. In the subdirectory it worked great, and it still does in the new directory, but whenever I post/edit an article, WP overwrites the .htaccess file already present in the main directory and the site freezes. I have to manually overwrite the htaccess file with the good one every single time.

    How do I stop wordpress from editing the htaccess file, or at least editing it correctly?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Did you keep the 1.5 .htaccess or do you have a new one?
    It is completely different for 2.x how WP handles the htaccess and permalinks.
    Do you have other stuff than WP in your .htaccess file?

    Thread Starter idiotopia

    (@idiotopia)

    I’ve deleted any htaccess file that was in the main directory, but WP keeps creating one that has the following:

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

    # END WordPress

    which does not work.

    The one I replace that with that makes it work is the following:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ – [S=45]
    RewriteRule ^(link_exchange)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(link_exchange)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(link_exchange)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(link_exchange)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(link_exchange)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(about_us)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(about_us)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(about_us)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(about_us)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(about_us)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /index.php?s=$1 [QSA,L]
    RewriteRule ^front_page/articles/category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/category/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^front_page/articles/category/(.+)/?$ /index.php?category_name=$1 [QSA,L]
    RewriteRule ^front_page/articles/author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^front_page/articles/author/([^/]+)/?$ /index.php?author_name=$1 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/page/?([0-9]{1,})/?$ /index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^front_page/articles/([0-9]{4})/?$ /index.php?year=$1 [QSA,L]
    RewriteRule ^front_page/articles/([^/]+)/trackback/?$ /index.php?name=$1&tb=1 [QSA,L]
    RewriteRule ^front_page/articles/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?name=$1&feed=$2 [QSA,L]
    RewriteRule ^front_page/articles/([^/]+)/page/?([0-9]{1,})/?$ /index.php?name=$1&paged=$2 [QSA,L]
    RewriteRule ^front_page/articles/([^/]+)(/[0-9]+)?/?$ /index.php?name=$1&page=$2 [QSA,L]
    </IfModule>

    # END WordPress

    Please help!

    Unfortunately, I cannot read .htaccess file code.
    All I can say is: the first example you gave above works for everybody else – if you didn’t have anything manually modified in your 1.5 htaccess!
    I was told that all those rules from the 1.5 version now are stored/handled (?) internally, so the short htaccess file should work.

    However, if you had a customized htaccess for 1.5… that would need the help of some htaccess gurus ??

    If you set the permissions on your .htaccess file to 555, WordPress won’t be able to change the file.

    Note that doing this also means that you won’t be able to write to the file, but you can easily get over this when you want to write to the file by changing the permissions to 755. Just remember to change them back again once you’re done!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘.htaccess problem – getting overwritten on post/edit’ is closed to new replies.