WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] "Pretty permalinks" and .htaccess> 404 Not Found Errors (15 posts)

  1. HollyJahangiri
    Member
    Posted 5 years ago #

    I installed WordPress 2.7. I imported a Blogger blog and comments.

    So far, success - everything looks fine. BUT, when I try to change the permalinks to http://jahangiri.us/news/2009/06/sample-post/, and create an .htaccess file in the directory with index.php, containing the following lines:

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

    the posts ONLY show on the front page of the blog. If I click the title or try to add a comment, I get a 404 error. I can still see posts and comments from the Dashboard; clearly, everything's still there.

    However, if I remove .htaccess and switch back to "default" permalinks, everything works fine.

    Any advice? This is quite frustrating. If it involves doing anything with the database, please use small words and straightforward declarative sentences; my knowledge of databases is...not extensive.

    The blog is here: http://jahangiri.us/news

  2. Samuel B
    moderator
    Posted 5 years ago #

    delete the .htaccess
    regenerate your permalinks
    admin - settings - permalinks

  3. HollyJahangiri
    Member
    Posted 5 years ago #

    Doesn't work. I get the following error on EVERY structure EXCEPT default:

    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.

  4. HollyJahangiri
    Member
    Posted 5 years ago #

    That is without any .htaccess file. When I created one, it seems to have worked, somewhat - the post URLs were structured correctly, but the pages did not exist and gave a 404 error.

    There's a similar thread under Troubleshooting, by the way - I'm not the only one having this problem.

  5. HollyJahangiri
    Member
    Posted 5 years ago #

  6. Samuel B
    moderator
    Posted 5 years ago #

    If your .htaccess file were writable, we could do this automatically, but it isn’t

    ahh...ok
    chmod .htaccess to 666
    update your permalinks
    chmod back to 644 for security
    it will work now

  7. HollyJahangiri
    Member
    Posted 5 years ago #

    Why will it work now, Samboll?

    I mean, I had an .htaccess file. I put those lines in it. The permalinks were updated, and looked fine, but when I clicked on the post title or comments links, I got a 404 Not Found error.

    What's changed since then?

  8. HollyJahangiri
    Member
    Posted 5 years ago #

    Okay - look at it now. I'll leave it broken for now, just to show what it's doing (but I'm going to reset it to default within the hour - this is uglier than ugly permalinks).

  9. Samuel B
    moderator
    Posted 5 years ago #

    well I can only assume your server is not allowing symlinks for some reason
    try adding this to top of .htaccess

    Options +FollowSymlinks
    RewriteEngine on
  10. gilzow
    Member
    Posted 5 years ago #

    @HollyJahangiri, our situations certainly SOUND similar, except I never received the "if your .htaccess file were writable" message.

    If you can, in the thread I started, list out the plugins you have installed. I want to see if there are any that we are both using that might be causing the issue.

    Wait, I just went to your site, and it looks like you have it working. What was the solution?

  11. webjunk
    Member
    Posted 5 years ago #

    Holly:
    Right now it looks like its working. Is it fixed or did you just reset it?
    The first thing is as Samboll suggested is adding:
    Options +FollowSymlinks
    to the top of .htaccess. Normally it is on by default but some hosting companies have it off to screw with people.

    The idea about creating an empty htaccess with 666 permissions and then running permalinks from WP-ADMIN is because wordpress does most of its rewriting within WP itself and not in the htaccess. WHen you change certain things like the static pages or URL settings you usually need to again set the permalinks, so WP can set its internal rewriteting.
    Also do you have an .htaccess file in the directory above? Could possibly cause inheritance issues.
    Lastly what are the URL settings in WP?

  12. stephenn
    Member
    Posted 4 years ago #

    Hello... I realise this thread is near a year old.... but i was longing for a solution to be at the end of it! and cant see one... yet!

    I need to ressolve this same issue:
    default and blog ok
    permalink and blog gives 404 page not found (the link and the htaccess work ok... and i added (to the top of the htaccess) the bit mentioned earlier in this thread...
    this is what my .htaccess reads at momment:

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

    What else (and where) should i do?
    cheers

  13. Samuel B
    moderator
    Posted 4 years ago #

    give a site link to see what you are talking about
    also, are you on a linux server?

  14. stephenn
    Member
    Posted 4 years ago #

    FOUND SOLUTION (for me):

    in the permalinks custom setting I had this:
    /index.php/%category%/%postname%/%post_id%/

    i removed the /index.php/ and just left it as this:
    /%category%/%postname%/%post_id%/

    Just thought would mention if may add an ''option to try'' that may help someone in future
    cheers

  15. unsemble
    Member
    Posted 4 years ago #

    Heya Folks,

    This worked for me, have a feeling it'll be at the root of a lot of problems here.

    If, like me, your .htaccess file didn't seem to be making a blind bit of difference no matter what was in it and adding RewriteEngine On didn't help then maybe you need to look at your vhosts.

    Mine had AllowOveride set to 'None', this means that .htaccess files for the domain were not observed or allowed to override the functionality set by the vhost. You need to set it to something else, in my case I set it to 'All'.

    sudo nano /etc/apache2/sites-available/yourdomain.com

    <Directory "/path/to/your/app">
      Options FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>

    Then disable and re-enable the site and reload apache :)

Topic Closed

This topic has been closed to new replies.

About this Topic