WordPress.org

Support

Support » How-To and Troubleshooting » Permalinks and htaccess issues

Permalinks and htaccess issues

  • Hi. I am new to WordPress, having just migrated from another blogging software. Everything is up and running just fine, except if I wish to use permalinks. If I try switching to permalinks, update the structure and insert and .htaccess file, I end up with a 404 error.

    Apache version 1.3.37 (Unix)
    PHP version 4.4.4
    MySQL version 4.1.21-standard

    I have checked with my host and mod_rewrite is enabled by default.

    What I put in my .htaccess file is this:

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

    I tried alternately placing the .htaccess in the root of the site, then in the /blog/ directory where the index.php file is located. No go.

    I am totally clueless at this point about where to go from here. I have reverted to the default link structure for the time being, but I’m hoping that with some help I can get permalinks working.

    The url of the site is http://benoitbisson.com

Viewing 15 replies - 1 through 15 (of 27 total)
  • Samboll, I have read the Using Permalinks topic prior to posting my questions.

    1. In the Using Permalinks topic, it says:

    When you create a permalink structure, WordPress will generate rewrite rules and attempt to insert them into the proper .htaccess file. If it can’t, it will print the rules out for you to copy and paste into your .htaccess file.

    In the Admin panel options, I have defined the directory where WP resides, as well as the URI I want shown. WP is in a /blog subdirectory, while the URI is set to show at the root level.

    My existing .htaccess is at root level. I have changed it to 666 in order for WordPress to modify it when selecting the numerical permalink setting. WordPress does not change the .htaccess (even though from what I read in the codex, it should) and does not print out rules for me to copy. All it does is tell me I should now modify my .htaccess file.

    2. When I try to use the .htaccess stated in my initial post, it generates a 403 error and a 500 error when that htaccess file is placed at the root. When I try putting it in the WP directory, I get a 403 error and a 404.

    Which brings me back to the question in my initial post.

    Ok, do you have the modified index.php in the root? If so, that’s where the .htaccess file goes also.

    Did you follow these instructions?
    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    OK Samboll, you put your finger right on the problem and my screw up. 🙂

    Here’s what was there, just so others who may make the same mistake as I did may know what the issue is.

    IF you already have an .htaccess in the root and you install WP in a subdirectory (in my case, it is under /blog), then you proceed to indicate that URL as the place where WP is, and the root as the URI you want shown, without moving any file, it will work fine with the default link settings.

    HOWEVER, that will prevent changes to the permalink structure to work and it will prevent WP from generating the correct .htaccess file required for the permalinks to work.

    So, don’t do as I did: rtfm. It will save you a lot of hassles. Moving and editing index.php, editing it with the proper path, and leaving my original .htaccess in the root, I then changed the permalinks in the admin panel. WP didn’t touch my .htaccess in the root, BUT created a new .htaccess in the /blog directory, which enabled the permalinks to work properly.

    Thanks for the help Samboll!

    I do have a very similar problem! In my case though i do still have an other script running in the root directory. Hence, cant make any changes to the index.php over there (plus this script requires its own htaccess to run). Are there any instructions what I could do to get the permalink changed in my subcategory?

    Your help will be greatly appreciated! 🙂

    Let’s try using the right terminology! Your blog is in a subfolder, not subcategory! (subcvat is an internal WP thing…)

    The instructions at the link given above about Using_Permalinks should give you all the information you need.

    Having trouble with terminology here. Let’s try it another way…

    In my dashboard/options/general =

    wordpress address = mydomain.com/blog
    blog address = mydomain.com/blog

    that said, my htaccess should reside =
    mydomain.com/blog/htaccess

    said another way =

    public_html/blog/htaccess

    right?

    Right.
    What’s wrong with the terminology?
    From the point of view of your whole site – “blog” is a subfolder.
    From the point of view of your WP installation – “blog” is the root directory of WP, not of the site. (For the whole site mydomain or public_html is the root)

    site seems to work fine but i am trying to update my htacess and not getting the results as described in WP ” permalinks/htaccess documentation.

    without changing by wordpress and blog address per above…

    1) my htaccess was outside the WP “blog” subfolder. i moved it into the subfolder. ok? note: there is zero code at bottom of permalink menu. i refreshed. no change. note: do you need to see the current code on the htaccess file?

    2) i looked at the index.php which says ” /* Short and sweet */

    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');

    do i change that to =

    require('./blog/wp-blog-header.php');

    Wait!
    If your blog is installed in example.com/blog and you display it at the same location (i.e. example.com/blog) then you should NOT mess with the sweet and short index file!

    However, if you did the move described in the Giving_WordPress_Its_Own_Directory in that case your settings in the admin > Options > General are wrong!

    So, I am not sure which case applies to you (since you give out contradictory information).

    Here is what I have =

    1) In my dashboard/options/general, from get-go =

    wordpress address = mydomain.com/blog
    blog address = mydomain.com/blog

    2) I then moved today htaccess in the wp “blog” directory and confirmed in this thread.

    3) my index.php is also in blog directory, from get-go.
    i have not edited this file.

    4) i make mention what is in the index file above and question is that correct or do i edit. what to do?

    am i being clear on this?

    Then why the hack are you posting in an old thread which IS about having the index moved? Yours is not.

    If your short index is in the “blog” directory and the blog is displayed at example.com/blog – don’t overcomplicate it!
    Do not touch the index and put your htaccess ONLY in the blog directory.
    Set your permalinks as you need.
    If the htaccess is writable WP will write the rules. If it is not, it will give you the code to paste into the htaccess file.

    did not mean to digress but this is the correct old thread = subject: permalinks and htaccess issues.

    my original problem = trying to figure out why i am being asked to update my htaccess and there is no code at the bottom as per documentation instructions.

    this thread is the best one for me to latch on to to date. it pointed to move the htaccess in the right spot.

    back to the question at hand for me = so why isn’t WP writing the rules = updating? why no code?

    the WP forum suggests i may not be the lone ranger on this one.

    Is mod_rewrite enabled on your server?
    The nice permalinks need that and the AllowOverride as well.
    You may want to ask your host.

    mod_rewrite has been good to go. and allow_override set at “ALL”

    what about the permissions conversation at the top of this thread?

    moshu, you bring up pretty. right now in default = ugly. thinking about making pretty. can i do this at this late stage in site development? my server is apache 1.3.3.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Permalinks and htaccess issues’ is closed to new replies.