WordPress.org

Ready to get started?Download WordPress

Forums

htaccess not working in 2.01 !! (18 posts)

  1. barunio
    Member
    Posted 8 years ago #

    I have installed a completely fresh version of WordPress 2.01 and I just cannot get permalinks / .htaccess to work correctly. The type of problem I am having makes me think it is a bug in the wordpress codebase, but I could be wrong. Let me describe:

    If I go to the Options > Permalinks tab without having an .htaccess file already in place and try to update my permalinks structure, I get the message saying "You should update your .htaccess now." --> that's all well and good except that *THERE IS NO TEXT at the bottom of the page for me to copy into an .htaccess file !!*

    If I create an .htaccess file, put it into the correct directory and chmod it to 777, and then update the permalink structure from within wordpress, it tells me that "Permalink structure updated" -- BUT IN REALITY THE HTACCESS FILE IS NOT MODIFIED AT ALL and permalinks do not work

    This is very frustrating, since I can't seem to find anyone else reporting this same bug !! Am I missing something here?? What could be causing this sort of behavior???

  2. barunio
    Member
    Posted 8 years ago #

    ^ bump ^

  3. Direkt
    Member
    Posted 8 years ago #

    First off, the content of the .htaccess file is just pattern recognition for the mod_rewrite module. It's generally 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

    So, that's basically what it should be. If it doesn't work, your server may not have mod_rewrite on.

  4. barunio
    Member
    Posted 8 years ago #

    mod_rewrite is indeed on, and i know how to manually edit the htaccess file to get it to do the right thing but i wanted to avoid that level of manual intervention (there can get to be a *lot* of rules in htaccess eventually).

    it turns out the problem was that my webserver for some reason was returning False to $is_apache -- and that breaks wordpress' ability to edit the htaccess file or create the code to post in htaccess.

    i commented out two lines in admin-functions and that solved my problem. (still talking with my web host to see why it returns false to $is_apache) :
    http://wordpress.org/support/topic/44270

    NOTE: if there are any WordPress folks reading this, please fix the error handling on this matter -- it really shouldn't tell the user that it has created the permalinks when it hasn't ...

  5. franto
    Member
    Posted 8 years ago #

    i have problems as well, but i got more such problems

    i got WP from 1.5, my .htaccess has always CHMOD 777, but in Options/Permalinks it said:

    If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.

    Do not know why...

    2nd problem
    i got bigger 9kB .htaccess with many changed things, because im using permalinks for changes...

    but after 2.0 and 2.01 update, now my .htaccess in admin page just ignore existing .htaccess and have there just few lines of code without my existing Pages permalinks...

    Does anyone know where is the problem?

    Thanks

  6. planetthoughtful
    Member
    Posted 8 years ago #

    @barunio: someone else had a similar problem and it turned out that their wp_options table didn't have autoincrement on the options_id field, where the rewrite rules are actually stored.

    See: http://wordpress.org/support/topic/59907?replies=3

    Much warmth,

    planetthoughtful

    [Moderated. 'Signatures' in posts are not permitted as they are impossible to police in terms of size, contents and links. It is appreciated if they would not be used.
    Thank you. - Podz]

  7. Japhy
    Member
    Posted 8 years ago #

    Hi!

    I seem to have a similar problem: I can't change my permalinks-structure because WordPress always tells me that my .htaccess is write-protected. But when I changed .htaccess to 666 and even 777, it didn't help either.
    Maybe the structure of my wordpress-installation is the problem: all the files besides index.php lie in a folder called "wp". My .htaccess also lies in this folder. Should I move my htaccess up to the "root"-folder? Everything else works for me. I've also checked folder permissions....
    Is there anything I can do besides editing htaccess by hand?

    regards,
    Japhy

  8. moshu
    Member
    Posted 8 years ago #

    all the files besides index.php lie in a folder called "wp".

    There should be a lot of files AND 3 folders: wp-admin, wp-content, wp-includes. If you don't have them it means the unzipping was unsuccessful. You have to tell your unzipping software to keep the directory structure.

  9. Japhy
    Member
    Posted 8 years ago #

    Moshu, all the files and 3 folders are in there. As I said, everything besides updating .htaccess is working ...

  10. adkbasecamp
    Member
    Posted 8 years ago #

    I have a similar problem as Japhy. WP 2.01, I have index.php and .htaccess in root, and the rest in subfolder. Everything works like a charm, mostly. I'm a total newbie at this with enough skills to be dangerous. I am methodical though and have only destroyed my install once.

    Updating permalinks seems to work, i.e. I can enter the new permalink address without the /index.php/ and it works fine. But WP does not display the permalink properly. Post titles have the permalink structure with /index.php/ included. Tooltips show "Permalink" and address displayed in status bar shows the nice permalink with /index.php/. Clicking the link in fact works as expected, nice link, but again with /index.php/.

    When I Update Permalink Structure, I'm told that I need to edit .htaccess. Also, I'm told that .htaccess is not writable so I have to paste this:

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

    I've looked everywhere and this looks odd to me. My .htaccess file is not accessable by WP, I manually created the file and uploaded it. I've tried several standard recommended variations of the above rewrite rule.

    I've tried all variations of 644, 666, 744, 777, etc. WP admin cannot write to the .htaccess or see it under Mangage/Files. I get the "Oops, no such file exists..." message. I don't want to manually edit .htacess if WP can do this for me, but I can't make it work. But I will if I have to.

    I've also tried an edited version of vars.php with the "Apache=1" thing; no apparent effect either way.

    I'm hosted on 1and1, basic linux, which claims to support mod_rewrite, but for some reason their customer support would not definitively confirms that. Instead, they sent me an email which contained the available commands for the mod server. No explanation, no "dear sir", nothing else. Wierd. PHP info test does not reveal any Apache module, Server API says "CGI" not Apache. This email was rec'd during the call, and the only thing the guy would say was "we are sending you an email, "you'll see"". Funny, my further query has resulted in silence, but I did receive a customer service survey! Ha.

    Any suggestions would be great, this one single feature is driving me insane.

  11. adkbasecamp
    Member
    Posted 8 years ago #

    I'm adding this to the above description:

    http://www.adirondackbasecamp.com/phpinfotest.php

    I do not see the mod_rewrite module.

    Thanks

  12. niziol
    Member
    Posted 8 years ago #

    EDIT: Are you sure you do have mod_rewrite then? To use .htaccess properly you should have mod_rewrite enabled on the hosting server.

    Well, your .htaccess is probably incorrect, you should use this (assuming your blog is in the root directory):

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

    Make sure your permalinks are set to the way you'd like them, then update them. You can just copy and paste the code that WP tells you to after updating your permalinks. Read the Using Permalinks article in the codex before you do anything.

    Good luck,
    Michael.

  13. adkbasecamp
    Member
    Posted 8 years ago #

    I have used that .htaccess before. My index and .htaccess is in root, I have WP in a subfolder. Tried it again, no change.

    I am not sure if I have mod_rewrite. If I didn't, wouldn't that prevent the permalink from working, both with or without /index.php/ showing? Is there a way to confirm, outside of a statement from my host?

    BTW, when I Update Permalinks, here is the code WP is telling me to copy:

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

    That doesn't look right to me.

    Also, I have an "index.php" in the wp-content folder with this:

    <?php
    // Silence is golden.
    ?>

    What's that? In a strange way, as frustrating as this permalink issue is, I'm kinda having fun trying to solve this puzzle. Thanks for all the help.

  14. niziol
    Member
    Posted 8 years ago #

    I tend to always cause my own problems, but as much as I bang my head on my desk and curse at the internet gods, it is always very rewarding to solve it in the end - and it's a great learning experience too!

    Try the following to test your rules:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^fake$ /index.php

    Just change "fake" to something else if you have a "fake" directory - the directory can not exist. Then try calling the fake directory and you should be redirected to the index.php page. I'm not sure if there is a better way, but that should work - if mod_rewrite is working, you should get the index.php page, otherwise you'll get a 404 if it does not.

    The index.php in the wp-content is just to prevent people from being able to view the directory contents. Every directory should have an index.php or be configured to prevent directory listing.

    Cheers,
    Michael.

  15. adkbasecamp
    Member
    Posted 8 years ago #

    Ok, did that. Tried to access /fake and got the main page with 404. I guess I don't have the mod_rewrite installed on the server. I will continue to bug my host. Thanks. phpinfo also does not show it installed.

  16. carnold
    Member
    Posted 8 years ago #

    @niziol-I too am having htaccess/permalink problems and have tried your above reccommended rewrite rule. My too returns a 404 page when trying to access the /fake directory (which does not exist). I do have mod_rewrite loaded and can be verified here http://www.mytimewithgod.net/phpinfo.php
    It doesn't appear that any rewrite rule is working for me? I have restarted apache2 and even reboot'ed the server (i have physical access to this server). Any help is appreciated

  17. niziol
    Member
    Posted 8 years ago #

    Unfortunately this is about the end of my knowledge of htaccess, the fact that you run your own server suggests that you are way ahead of me in all-things apache!

    Good luck though, I wish I could be of more help! Please be sure to post any solutions you come up with!

    Cheers,
    Michael.

  18. j0hnt3l4d
    Member
    Posted 8 years ago #

    If none of the above steps are working, and you feel comfortable manually editing your apache configuration file, you may need to ensure the the AllowOverride directive is not set to "None". If this directive is "None", then the .htaccess file is ignored.

Topic Closed

This topic has been closed to new replies.

About this Topic