WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess & Permalinks Problem (28 posts)

  1. nickdominguez
    Member
    Posted 9 years ago #

    Here is my problem:

    I've created "pages" in my wordpress installation and now would like use cleaner URI's, ie. point the pages to directories.

    My wordpress installation did not create an .htaccess file so I create a blank .htaccess file, upload it, and CHMOD it to 666. I then go into my WP admin and change the permalink structure. When I do this I get a "Forbidden" error on the site.

    If someone is familiar with this problem please let me know how I can fix it. Maybe i'm using the wrong permalink structure? Or maybe I have to add some extra code to the .htaccess file that I don't know about?

    I'm hosting the site on mediatemple if that helps diagnose the problem at all.

  2. moshu
    Member
    Posted 9 years ago #

    So, what kind of permalink structure are trying to use? BTW, if it is WP 1.5 you don't have to add anything to the .htaccess file - WP creates it for you.

  3. nickdominguez
    Member
    Posted 9 years ago #

    Thanks for the reply moshu.

    I eventually figured it out. WP wasn't generating an .htaccess file for some odd reason. The problem was 1 line of code I had to add to the file before my rewrite rules which I wasn't able to do because everytime I added the .htaccess file my site would error and be "forbidden"

    What I did was log into my web control hosting panel and edit the .htaccess that way, added that line of code and it fixed the problem.

    BTW, this seems to be a problem on mediatemple hosting accounts. FYI

  4. chrismclay
    Member
    Posted 9 years ago #

    Hi Nick,

    Can you let us know what you did to fix the problem? I also have a media temple account and am having problems with the htaccess file.

    Thanks,
    Chris

  5. jimhobbs
    Member
    Posted 9 years ago #

    The problem was 1 line of code I had to add to the file before my rewrite rules which I wasn't able to do because everytime I added the .htaccess file my site would error and be "forbidden"

    --

    Nick - what was the extra 1 line of code you added?
    I still can't get permalinks / mod_rewrite / .htaccess to function properly on my site :(

  6. jimhobbs
    Member
    Posted 9 years ago #

    Would this addition to the nightly build do anything?
    http://trac.wordpress.org/changeset/2510

    I tried modifying my wp-blog-header.php file with the new lines but it doesn't fix the problem

    ps. how do you download the newest nightly update ?

  7. chrismclay
    Member
    Posted 9 years ago #

    Hi,

    I found the one line you need. You can add this to the wordpress htaccess file, or I just created a new htaccess file in the root directory of my site:

    Options +FollowSymlinks

    This will make everything happy and good :-)

    Chris

  8. jimhobbs
    Member
    Posted 9 years ago #

    Hi Chris
    I tried your suggestion a couple of ways but neither worked for me

    I tried uploading via FTP a new .htaccess file to my blog directory containing just the one line:

    Options +FollowSymlinks

    this didn't work. Tried it with CHMOD setting 666. no luck....

    I also tried in the admin panel of Word Press (MANAGE > FILES) adding the line

    Options +FollowSymlinks

    just before the line

    # END WordPress

    and then 'Update File'

    Still I get a 404 error when trying to view fancy permalinks?

  9. jimhobbs
    Member
    Posted 9 years ago #

    I'm just wondering if I have the .htaccess file in the right place

    My webspace is with oneandone.co.uk
    and I run several domains from the one account

    In the absolute root of my 1&1 account I have a .htaccess file
    I also have another .htaccess file in the directory where my blog is

    my blog is located from the root at
    /jim_hobbs/blog

    which relates to :
    http://www.jimhobbs.com/blog

    I am assuming that the .htaccess file relating to Word Press should be in
    /jim_hobbs/blog

    rather than in
    /

    Would the reason for my errors and problems be because of two .htaccess files?
    ??

    I am quite literally tearing my hair out with this problem
    I can get my blog working with the normal permalinks, but I definitely want fancy permalinks (so I can get index properly on search engines)

  10. rdhdjn
    Member
    Posted 9 years ago #

    Hi,

    I had the same problem -- I found the answer in the WP Codex, which says the .htacess file should go in... "in the directory in which your main index.php file resides. For example, if your WordPress blog is installed at domain.com/wordpress/, put the .htaccess file at domain.com/wordpress/.htaccess"

    Copy the contents given for the .htaccess file in the window where you set the permalinks, paste it into a text file, save as .htaccess and FTP it to your main WP directory as above.

    Rob

  11. kappaluppa
    Member
    Posted 9 years ago #

    my index.php file is right in the root of the domain, so it is http://www.backboneamerica.net/index.php.

    When I put the .htaccess in that directory, stops all files from being seen.

    now what?

    (thanks)

  12. kappaluppa
    Member
    Posted 9 years ago #

    I tried again... ARGH!!!!

    I created an empty .htaccess file & uploaded it and chmod to 666
    I changed my permalink structure and click "update permlink structure"
    Got the message: Permalink structure updated.
    I tried using other links in admin and got FORBIDDEN - no access to the pages.
    I tried viewing the site and got my Fedora Core Test Page.

    I remove the .htaccess file and my pages come back.
    HOWEVER... none of the links on my page work (go figure!) BUT the link structure is correct! (/%category%/%author%/%year%/%monthnum%/%day%/%postname%/)
    it's just that the link can't be found.
    The requested URL /backbone-america/john-andrews/2005/04/18/jan-31-05-ship-him-to-tehran-tech/ was not found on this server.

    And I noticed that the http://www.backboneamerica.net/ part is not there...

    WHAT AM I DOING WRONG! BOOO HOOOO HOOOOOO!

    Thanks, all!
    Kathy

  13. kappaluppa
    Member
    Posted 9 years ago #

    Trying yet again...
    I tried adding /index.php/ and that didn't help either, and I checked on my mod_rewrite is loaded...

  14. kappaluppa
    Member
    Posted 9 years ago #

    Got it!
    It was a combo of info here, info there, info from everywhere. And in the process I've learned a lot more that I don't know (huh?)

    Bottom line is that I had to set the FollowSymLinks directive to yes in Apache. It didn't work in the .htaccess file.

    Whew! Hope my painful experience will help some other confused soul!

    K

  15. jimhobbs
    Member
    Posted 9 years ago #

    >>Bottom line is that I had to set the FollowSymLinks directive to yes in >>Apache. It didn't work in the .htaccess file.

    Can you explain how you do this in Apache?
    I have no knowledge on how to load, edit or do anything in Apache?
    If you could explain in laymans terms that would be great :)

  16. CHUD
    Member
    Posted 9 years ago #

    I'm having trouble with this too and none of the above seems to apply to my situation.

    I'm running WP1.5. My WP URI is /domain.com/blog/wordpress while my blog URI is domain.com/blog.

    I'm trying to change my permalink structure to /%year%/%monthnum%/%day%/%postname%/ from the Dashboard. When I hit "Update Permalink Structure" I get a message saying my .htaccess isn't writable and giving me the mod_rewrite rules I need in .htacess. At this point the links on my main page did change, but clicking on them gives a 404.

    So, time to modify the .htaccess file manually. But the thing is: I don't *have* an .htacess file, or at least I can't find it. So I created one with the mod_rewrite rules provided. I uploaded it to domain.com/blog, chmod it to 666 and my blog goes "500 Internal Server Error".

    I delete it out of domain.com/blog and put it in domain.com/blog/wordpress, chmod to 666. Now the site loads but it's lost all the formatting -- the content is there, but all theme and formatting is gone.

    What am I doing wrong?

  17. Glutnix
    Member
    Posted 9 years ago #

    I think I just figured out what's happening with my similar problem:

    First, this is how my site is set up (it's on a lan, so the urls will be invalid)

    Options > General page:
    WP address: http://justfocus.dev/articles
    Blog address: http://justfocus.dev/articles

    General > Permalinks:
    Structure: /%year%/%monthnum%/%day%/%postname%/
    Category Base: /categories

    There is a hidden option which throws spanners in the works, so check it to be sure:
    In the wp_options table there is an option called blogfilename. Mine is set to /articles/

    Right. Now the problem is that even though my blog is set up in /articles/, WP insists on writing to /.htaccess for it's permalink structure. I think I solved it by

    1. moving /.htaccess to /articles/.htaccess
    2. manually editing /articles/.htaccess and replacing all occurances of /index.php? with /articles/index.php?.

    WordPress still thinks the blog homepage is at /articles/, but because I'm using a heavily modified theme, it's not affecting me yet.

  18. kappaluppa
    Member
    Posted 9 years ago #

    >>Bottom line is that I had to set the FollowSymLinks directive to yes in >>Apache. It didn't work in the .htaccess file.

    Can you explain how you do this in Apache?
    I have no knowledge on how to load, edit or do anything in Apache?
    If you could explain in laymans terms that would be great :)

    ==================

    This may be a hard thing to answer if you do not use virtual hosts. Check with your host if you do not manage your server on your own.

    If you want you can get back with me to let me know you specific setup and I can see if I can help you figure it out.

    Kathy

  19. viitoria
    Member
    Posted 9 years ago #

    Here's what I did when I got just about every single problem posted on this page.

    1) Make a .htaccess file, but leave it blank.
    2) Upload it into the directory your WP index.php page is.
    3) Change chmod of the .htaccess to 777
    4) Update permalinks
    5) Change chmod of .taccess back to 644 (for your own protection)

    It should work now. Hope this helps.

  20. TimHardy
    Member
    Posted 9 years ago #

    I've struggled with this for a couple of days and finally got it to work using exactly the same steps as the poster above but with the addition of one step:

    4b) edit the .htaccess file generated by wordpress and add the line Options +Followsymlinks so that the first three lines of this file now read:

    <IfModule mod_rewrite.c>
    Options +Followsymlinks
    RewriteEngine On

    (There's no point adding this line before WP updates the .htaccess file: you addition will just be overwritten.)

    This is assuming of course that Apache is configured to allow .htaccess files. You need AllowOverride to be set to All in your /etc/apache2/httpd.conf and .htaccess to be defined as the name of the file that can override the default settings. The section should look something like this:

    <Directory />
    Options None
    AllowOverride All
    Order deny,allow
    Deny from all
    </Directory>

    # use .htaccess files for overriding,
    AccessFileName .htaccess

    Hope this helps someone

    Tim

  21. p_toolan
    Member
    Posted 9 years ago #

    Both Tim and Viitoria, I can't tell you how much that helped: there are so many places online that give hints at how to edit a .htaccess file, but don't really actually show you what's going on. Now, after over 24 hours of on and off looking online for an education in Apache rules, I think I've got everything sorted.

    The most grateful thanks to you both.

    Patrick

  22. kelvin
    Member
    Posted 9 years ago #

    I have a similiar problem.

    The htaccess file is created and update correctly.

    When i set a perm link, the link it self seems to work, but i only get the title of the document. Not the document body.

    I can't seem to find this error noted anywhere.

    kelvin

  23. Ringo
    Member
    Posted 9 years ago #

    On a side note. I've had similar problems with WP and .htaccess and I noticed that it was basically at one location (meaning: it was always the same hosting company) Double check with them HOW they have rewrite_mod installed and configured. At this particular hosting facility you actually had to turn on all the options just to use ONE of the features. So you might try putting this at the very top of your htaccess file: "options all".

    Hope that helps

  24. poultryfarm
    Member
    Posted 8 years ago #

    great info here. like many i've been struggling with this for a long time. finally adding Options +Followsymlinks solved the problem.
    I just have one tip to add though that I haven't seen mentioned yet.
    adding Options +Followsymlinks to .htaccess solved the problem, but i would have to close off the permissions so that wordpress couldn't ovewrite it again (if for example i decided to change my permalinks again). i wanted a way to have wordpress generate the right code everytime without having to manually add it. so i went into wp-includes > classes.php and added this line $rules .= "Options +Followsymlinksn";
    between these two original lines:

    $rules = "<IfModule mod_rewrite.c>n";
    $rules .= "RewriteEngine Onn";

    now it writes the code correctly everytime. no need to mess with the .htaccess file. My knowledge of php is zero and i am knew to wordpress so if there is a smatter way to do this or i have done something silly i am eager to know. so far so good though. hope this helps somebody else.

  25. 702
    Member
    Posted 8 years ago #

    Holla,

    Pretty much replies in this topic but unfortunately they can't solve my problems...
    It's really simple: on my host (uw.hu) .htaccess is a not supported file... any ideas how to get out of this sad situation?

    thanx a lot: 702

  26. mtupper
    Member
    Posted 8 years ago #

    Wouldnt you know it... I have tried everything here. Tim, Victoria, PoultryFarm, etc... and still no dice! I am at my wits end. I have one nagging suspition that it has to do with the mod_rewrite issue with apache2. I guess what it comes down to is that I am not exactly sure how to be sure that this is installed and running on my Apache2 server. Can someone explain in more detail??

    I have tried the directives in the apache2.conf
    I have copied the rewrite.load from mods_available to mods_enabled
    I have played with the .htaccess every which way

    My setup: Apache2, PHP5, MySQL 4.1

    Funny thing is, I am developing my site on my laptop and I have already contracted hosting on GoDaddy to upload it there when I finish the major mods to the theme etc... and after going at this for 2 days to get pretty permalinks to work, I just read a another post here explaining why this wont work on GoDaddy because they dont allow the mod_rewrite to work on there servers. But I feel I have come this far, I must resolve this anyway!!!

  27. mtupper
    Member
    Posted 8 years ago #

    UNBELIEVABLE...

    About 45 Seconds after posting the last one... I got it to work!!!

    The problem was: I was focused 100% on the apache2.conf file to ensure the AllowOverride All was set in the <Directory />...

    But I failed to realize there is ANOTHER config file of importance, one with the <VirtualHost> which was at /etc/apache2/sites_enabled/default000

    ARRRGGG!!!

    Thanks for everbody's postings here... the solution is here somewhere.

  28. dax702
    Member
    Posted 7 years ago #

    For anyone wondering, this .htaccess will work fine on Godaddy if you're on their deluxe hosting plan.

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

    # END WordPress

    Make sure that the file is in the root directory of wordpress and you may have to wait up to an hour for the change to take effect for whatever reason.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.