Pretty permalinks without mod_rewrite

There are still some third-class web hosters who do allow the .htaccess files … and turn off the standard module mod_rewrite. But without mod_rewrite, WordPress cannot use pretty permalinks, right? Wrong!

There’s another directive we can use: ErrorDocument.

ErrorDocument 404 /index.php

This will do almost the same as the rewrite rules WordPress offers. It will not work with caching plugins like W3 Total Cache, it will not catch empty searches and other .htaccess tricks you may want to use. So consider this trick as a temporary solution until you have found a real web hoster.





7 responses to “Pretty permalinks without mod_rewrite”

  1. […] WPEngineer schreibt Thomas Scholz einen kurzen Tip, wie man bei schlechten Hostern schöne Permalinks über die htaccess-Datei erzeugen kann, […]

  2. Donncha O Caoimh Avatar

    I presume WordPress doesn’t think every url is a 404? This should work with WP Super Cache in “PHP caching” mode, but I haven’t tested it of course!

  3. toscho Avatar

    This is about the server, not WordPress. The trick is to send any request that doesn’t match an existing file to WordPress like the usual .htaccess rules do.

  4. Joshua chase Avatar
    Joshua chase

    Great tip, I didn’t realize you can use error document that way. Iand so true “find a real host” lol.

  5. Frederick Townes Avatar

    Similiar to what Donncha said, Basic mode will work fine in this case described here with W3TC as well as all of the other performance optimizations it provides.

  6. Kaspars Avatar

    You have to be careful with this because WordPress doesn’t set the HTTP Status header 200 by default. Just make sure that all your pages are not returning 404 status header when using this approach.

  7. […] zwar den Zugriff auf .htaccss, aktivieren aber anderseits das mod_rewrite nicht. Thomas Scholz beschreibt wie man hier trotzdem noch zu sprechenden Permalinks kommen […]