WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks and htaccess issues (28 posts)

  1. Benoitbis
    Member
    Posted 7 years ago #

    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

  2. Samuel B
    moderator
    Posted 7 years ago #

  3. Benoitbis
    Member
    Posted 7 years ago #

    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.

  4. Samuel B
    moderator
    Posted 7 years ago #

    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

  5. Benoitbis
    Member
    Posted 7 years ago #

    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!

  6. hilrap
    Member
    Posted 7 years ago #

    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! :-)

  7. moshu
    Member
    Posted 7 years ago #

    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.

  8. ronchicago
    Member
    Posted 6 years ago #

    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?

  9. moshu
    Member
    Posted 6 years ago #

    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)

  10. ronchicago
    Member
    Posted 6 years ago #

    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');

  11. moshu
    Member
    Posted 6 years ago #

    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).

  12. ronchicago
    Member
    Posted 6 years ago #

    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?

  13. moshu
    Member
    Posted 6 years ago #

    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.

  14. ronchicago
    Member
    Posted 6 years ago #

    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.

  15. moshu
    Member
    Posted 6 years ago #

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

  16. ronchicago
    Member
    Posted 6 years ago #

    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.

  17. funkyvega
    Member
    Posted 6 years ago #

    aww shti.. I think i was messing aroudn with the:
    "wordpress address = mydomain.com/blog
    blog address = mydomain.com/blog"

    thikng in the options.. And now my blog won't work.. I cant even login to the admin.

    anybody know how i can fix it?

  18. mrmist
    Forum Janitor
    Posted 6 years ago #

    anybody know how i can fix it?

    I think it's explained in the docs how to fix it if you do that.

    Basically though you'll need to edit the database directly.

  19. mrmist
    Forum Janitor
    Posted 6 years ago #

    ... change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar).

  20. funkyvega
    Member
    Posted 6 years ago #

    awesome.. what a close one. thanks alot.

  21. moshu
    Member
    Posted 6 years ago #

    ronchicago,

    You can switch from the default (aka ugly) any time. BTW, the default/ugly permalinks ALWAYS work, no matter what kind of "nice" structure you set up.

    Seemingly, you have all the preconditions to make the nice permalinks to work. Unless we misunderstood each other about the settings and the location of the blog - it shouold work.

    As I understood your setup:
    NOTHING (blog related) in the root;
    everything is in the "blog" directory - so the short index and the htaccess should also be there and only there;
    - is this correct?

  22. ronchicago
    Member
    Posted 6 years ago #

    correct!

  23. funkyvega
    Member
    Posted 6 years ago #

    hey moshu.. I was having problems with a custom structure i made.

    But i hcanged back to the ugly/default ones that are there..

    But now when I try to view a post, the page/design moves up.. Like the CSS doesn't work for soem reason in teh single post page.

    is that supposed to be changing? Check it out: http://www.freshbasilcrew.com

    click on any post to see.

  24. moshu
    Member
    Posted 6 years ago #

    is that supposed to be changing?

    Nope. It's just bad code.
    Validate your site and we'll see it it works

  25. funkyvega
    Member
    Posted 6 years ago #

    :(

    i checked it out.. and i dont seem to see any big issues. Only the podpress stuff, but i dont even use that on any pages yet.

    http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.freshbasilcrew.com%2F2007%2F08%2F17%2Ftalib-kweli-hot-thingin-the-mood-official-video%2F&warning=1&profile=css21&usermedium=all

  26. ronchicago
    Member
    Posted 6 years ago #

    two months later and i finally go back to this issue. i change from ugly to pretty. i try to update htaccess but no can do. then i read forum advice for the 99th time. bingo! i change my htaccess from 644 to 666 via cpanel and everything is updated! now i am back at 644. onwards and upwards!

  27. Rookietime
    Member
    Posted 6 years ago #

    Moshu,

    You can switch from the default (aka ugly) any time. BTW, the default/ugly permalinks ALWAYS work, no matter what kind of "nice" structure you set up.

    Does this mean that if I started with www.yourdomain.com/wordpress/?p=100 and changed the permalinks to reflect www.yourdomain.com/wordpress/wordpress/2008/01/26/sample-post/ that both links would still work?

  28. Rookietime
    Member
    Posted 6 years ago #

    Can anyone answer? I didn't want to change over if not due to not knowing permalinks well yet.
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags