permalink-chain
WordPress permalink error resolved.

Just a quick post to let you know of a solution to a problem i have encountered twice now when developing on clients servers over which i have no real control.

The issue arises when using WordPress and turning on ‘permalinks’, suddenly nothing works and you are shown a blank white page with the following error:

Forbidden, perhaps you need to change the file permissions for this document or upload an index page.

Now first things first, ..always check you have a .htaccess file at the root of your wordpress folder (you may need to refresh your file view as WordPress may have only just created it).

Assuming you are using the /%postname%/ custom link structure as i was your .htaccess file should look like this (this also assumes your WP installation is in the root directory of your domain, ..but this doesn’t really matter WP generates this code for you automatically anyway):


# BEGIN WordPress

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

# END WordPress

So assuming you have this correct permalink .htaccess file content and then like me it is still not working, …just add these two magic lines to the top of the file:

Options -Indexes
Options +FollowSymLinks

Now your completed .htaccess file will look like this:


Options -Indexes
Options +FollowSymLinks

# BEGIN WordPress

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

# END WordPress

…and work perfectly.

Leave a comment...

27 comments

  1. Ian says:

    cheers – works a treat

  2. patrick says:

    Great post. Fixed my problem. Thanks

  3. Nick says:

    Why can’t they spell it out in the help documents like this… eureka, many thanks!

  4. mog says:

    ..because it is a server issue, ..well not issue, ..but ‘issue’ :) …it never happens on my mediatemple servers, ..only occasionally on clients server.
    I am sure there is a fix i could implement that mean’t speaking to a disgruntled server admin in a small air-conditioned box in the basement of their offices …but i prefer this method.

    Happy to help.

  5. theCaller says:

    I have tried it. I uploaded it with the ftp program but, it still won’t work. when i tried to open it, it was blank white, same as before. Is it caused by the cache??

  6. mog says:

    It should not be caused by the cache no, ..please let me know the following:

    - does it work with permalinks turned off?
    - if you put the following in your .htaccess file does it redirect to google (replace everything, ..it is just a test to see that your htaccess file is working)?

    redirect 301 / http://www.google.com/

    Let me know your findings,

    Sorry for the delay in my responses, i am on an african island with no electricity until thursday.

  7. Darren says:

    Thanks dude. Fixed my problem when hosted on 123-reg.co.uk

  8. Thank you! It worked perfectly!

  9. Mike says:

    where is this .htaccess file, I do not see one in my directory, what do I do if I do not have the file?

  10. mog says:

    If you are using permanlinks successfully then the chances are your FTP program is not set to show hidden files (files with a . before them are hidden) which you should be able to change in the preferences, …otherwise, ..simply make it at the root of your wordpress install.
    .htaccess is a very important and powerful file, perhaps read this article first http://www.freewebmasterhelp.com/tutorials/htaccess/

  11. Heyda says:

    How does the htaccess file need to look when the WP installation is not in the root but in a folder (let’s say called ‘subfolder’)?

    Thank you

  12. mog says:

    With regards to the problem mentinoned in this post, ..the same, just in that subfolder that you are using as the WP root, rather than the domain root.
    With regards to custom permalinks, ..WP generates the correct code for this in the permalinks menu option under settings.
    Hope that helps.

  13. Arne S says:

    Holy Jesus, this was frustrating. It was the symlinks line that got it working for me. Thanks for the post, it was one of many that I read, but the only one that worked.

  14. Worked flawlessly – thanks!

    Options -Indexes
    Options +FollowSymLinks

    did the trick!

  15. Brian says:

    Nice fix, thanks.

  16. Dave Rave says:

    Hi, I used this on http://www.gbforklifts.co.uk and http://www.forkliftblog.co.uk works perfectly, they should really include this on the wp website its a great article.

    Thanks

  17. Rizvan Vadia says:

    This worked now.

    Thanks

  18. MR Water says:

    This is great, worked perfectly first time on http://www.deionisedwatersourcegb.co.uk great website keep up the good articles.

    Thanks for your help

  19. Finally i solved my permalink error thanks to this great site. I had massive issue on my photography site which is http://www.asianweddingphotographyz.com

    Thanks a lot for the nice fix.

    Keep up this lovely website.

  20. Sabir says:

    THanKs, WOrks Good.

  21. Chris says:

    Thank you. Worked perfectly first time.

  22. Warren says:

    Saved me heaps of heartache. Thank you for sharing.

  23. Ben says:

    You sir, are a legend, you just saved me my sanity and a nights sleep. Cheers!

  24. Mark says:

    Sorted my issues – great post. Thanks!

  25. Vladimir says:

    It helped to resolve my problem inspite of the post is 4 years old.
    Thanks a lot.

  26. Ravi says:

    this solutions is not working with my problem. is their any relationship between php.ini please reply me

  27. Ravi says:

    I did this changes also
    Options -Indexes
    Options +FollowSymLinks

    # BEGIN WordPress

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

    # END WordPress

    it gives error
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

This site is not up to date. I really should take it down and make a new one as I have been busy with a lot of cool projects and clients recently, but currently do not have the time to rebuild it.

So, it stays here, but please note it has not been updated in a while and if you need to get in contact with me please just email me directly at mog@mogmachine.com or phone me on +44 (0)7960 214407.

Thanks,

Marcus (mog)