WordPress.org

Support

Support » How-To and Troubleshooting » Cruft Free URL’s (1.0)

Cruft Free URL’s (1.0)

  • Hey guys, I was wondering if anyone else has had this problem.
    I have had some trouble getting the mod_rewrite rules to work on my apache installation. I found out yesterday what was giving me the trouble.
    I have for the last year or so been running my blog without file extensions. Basically this means that you would link to chrisjdavis.org/index instead of /index.php. This is much better usability, and ensures that no matter what technology I use to power the site it all remains transparent to the user.
    This process requires mod_negotiate to be enabled; but of course as I have found out for some reason if negotiate is enabled the WP created rewrite rules bork. So now I am at an impass, since honestly the usability given by negotiate is more important than that given by Cruft Free URL’s. So I wanted to throw this out, first of all so that if anyone else is having “mysterious” problems like I was, and is not really using negotiate they can comment it out and be able to take advantage of the WP feature. Second I wanted to know if anyone might have any thoughts on how to get around this, since I am going to need to keep negotiate enabled.
    Any help is of course appreciated.
    Chris

Viewing 7 replies - 1 through 7 (of 7 total)
  • Ok… dumb first question but I have to ask: did you take the .php out of the rewrite rules?

    No dumb questions antifuse, and yeah I did.

    Ok… next question then – how exactly do the rewrite rules bork? Are they not catching what needs to be replaced? Or are they replacing it, just with the wrong stuff?

    They are rewriting the URL’s correctly but, when you click on them it basically is refreshing the page. It loads the entire site again and not what you specifically wanted to isolate, like a post or category.

    Put .php back in the rewrite rules. Rewritten content is not passed through mod_negotiation, it is processed after that. I do this all the time on my site so I can promise it works.

    While it now works and doesn’t bork negotiate, I no longer have extionsionless pages, once you click on any link that is output by wordpress, since it is rewritten based on the rules in the .htaccess file which specify that the URL should be rewritten using index.php, you lose the nice sans-extionsion.
    So I am again at an impass, since I am falling on the side of wanting extensionless pages way more than prettu URL’s
    This is getting really irritating.
    UPDATE: Well I have been able to get it all playing nice together in a very strange way. Here are my rules from the .htaccess file:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?([0-9]+)?/?$ /index?year=$1&monthnum=$2&day=$3&name=$4&p=$5&page=$
    RewriteRule ^index.php/category/?([0-9a-z-]+)?/? /index?category_name=$1 [QSA]

    With that in thier the re-writing works. Of course now my image URL’s are all shot to hell, but that is pretty easy to fix, stupid preceding slashes. I am still not sure why removing the .php from the string that signifies what to re-write from would make it all work, but hey, take ’em how you can get ’em.

    No offense, but I think you’re missing part of the point of leaving the extension off pages. It’s the public interface that matters, not what is going on in the backend. mod_rewrite allows you to present technology independent URIs that are, in my opinion, better than the best that can be offered by mod_negotiation. I’ve done a lot of research into this. Negotiated URIs actually have a lot of problems with some user agents as well, particularly handheld and phone ones which send send correct but unusual accept headers.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cruft Free URL’s (1.0)’ is closed to new replies.
Skip to toolbar