• Resolved rhys

    (@rhys)


    Is htaccess (with mod_rewrite) not needed for permalinks anymore??

    I notive that one blog I have (2.8.6) works fine without the usual mod-rewrite code in htccess. Switch it it to default, and it works, switch it back to permalinks (/index.php/%category%/%postname%/) and it still works fine.

    WP used to show the htaccess rewrite code at the foot of the page after setting permalinks, but that doesn’t show either anymore!

    Can anyone confirm this behaviour?

    This will be magic if we don’t need to bother with mod_rewrite anymore to run ‘pretty’ permalinks.

Viewing 15 replies - 1 through 15 (of 23 total)
  • /index.php/%category%/%postname%/ is not a mod_rewrite format. If you have something like MultiViews enabled, the server will recognize index.php as the destination.

    I wonder why you need index.php there? remove it.. use just
    /%category%/%postname%/

    Thread Starter rhys

    (@rhys)

    @seoyourblog
    Bad advice! Because I have had several blogs lately that will not work with pretty permalinks starting with /%category%/.

    Google for “Starting Permalinks with %category% is strongly not recommended for performance reasons” to see one reason why.

    @miqrogroove
    I am talking about a plain standard WP default blog, on a plain standard Apache server, not using anything esoteric like Multiview, or any plugins/widgets other than Akismet.

    Actually it’s necessary. To use pretty links, WP will create an entry on your .htaccess file (or create a new one if you dont have it yet on your root), pretty much like:

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

    If WP for some reason cant do it, you need to do it yourself manually, otherwise no pretty links…

    Are you sure there’s not such entry on the .htaccess file on your blog root? In my experiences, things don’t go fine without it.

    cheers

    p.s.: yes, for some hosts it’s necessary to add “/index.php/” on the formula…

    Maybe because of using /index.php/ in the formula, mod_rewrite is not necessary to make things run. I guess that’s what Miqrogroove meant. I wasn’t aware of that.

    Thread Starter rhys

    (@rhys)

    @vangrog

    You said:”actually it’s necessary. To use pretty links, WP will create an entry on your .htaccess file (or create a new one if you dont have it yet on your root), pretty”

    Actually it is not necessary, on these 2.8.6 installs, it is working fine without it amd there is no sign of htaccess being created. On my older blogs, every time I set up permalinks, it showed suggested new code for htaccess.

    It looks to me like there is now some provision built in for Pretty Links that doesn’t need the mod_reWrite in htaccess.

    Hi,

    Set your desired permalink add this code in htaccess:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Thanks,

    Shane G.

    Rhys, .htaccess is necessary to set pretty links, and not necessary to use almost pretty links (the ones you’re using are called “almost pretty”, because of the “/index.php” part). That’s my guess, according to what I know and what Miqrogroove explained (also, Miqrogroove is an expert; considering what I’ve read, written by her on this forum, I can say she knows alot — so, I believe what she says).

    If you use a pretty link structure, such as “%pots_id%/%postname%/” (without “index.php” in the beginning), things will only work with mod_rewrite set on your .htaccess.

    Cheers

    Which reminds me, I need to update my profile to explain the gravatar I’m using… >_>

    rhys is correct actually.

    /index.php/%category%/%postname%/

    … works with standard PHP library when path checking is not enbaled (off by default in Apache, on by default in IIS). I was thinking of the MultiViews format…

    /index/%category%/%postname%/

    … the latter being considered “correct” so that the URLs aren’t all broken if WordPress stops using PHP. Why rhys can’t just use proper date permalinks to enable unhindered category management is a matter of personal preference I guess.

    Thread Starter rhys

    (@rhys)

    @miqrogroove

    Thanks for the explanation, I had several blogs break when I updated them to 2.8.6, but they worked again when I included the /index.php/.

    Still don’t understand why my latest blog version makes no attempt to write/update htaccess??

    As to why I don’t use the “ugly” proper(?) date format links, I set up “top 10” blogs that rank very well for the site keyword, and to pull off that trick I need proper keyword linking in the URLs and anchor texts
    ?? – Rhys

    It’s starting to sound like a file permissions issue. Make sure the index.php directory and the .htaccess file are both writable.

    I don’t know off the top of my head what triggers the .htaccess updates. I prefer it not to happen at all because previous versions of WordPress have made invalid changes leading to the “white screen of death”.

    Thread Starter rhys

    (@rhys)

    @miqrogroove

    Looks like your theory about index.php is the one. I’ve set up a test site WordPress Test Site and tried all the listed Permalink combinations, and they all work happily WITHOUT htaccess/mod_reWrite, provided there is index.php preceeding the permalink.

    This applies to 2.9.0 as well (Upgraded and tried it) and it still makes no attempt to upgrade/write htaccess.

    P.S., and please update your profile miqrogroove – it does absolutely NOTHING for your credibility to have an icon that suggests you are a 17 year old sex-kitten????

    ?? – thanks, Rhys.

    She’s 22, and my profile is updated. ??

    It looks like WordPress is supposed to update .htaccess every time you change the permalink settings. So I think it is very likely a file or directory permissions issue preventing it from happening.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘htaccess not needed for permalinks’ is closed to new replies.