Easier permalinks solution.
I’ve hit upon a simpler way to get simple permalinks using WP 1.5, without requiring the big, hairy .htaccess code that WP generates. For some reason I could never pin down, my web server never worked right with that code — I would always get a 404 error page instead of the index.php output that a properly rewritten URL should have generated.
In my solution, you still need to edit your .htaccess file but the code is a lot cleaner. Here’s how to do it:
1. In your WP directory, copy index.php to a file just called “archive” (no extension). Like this:
cp index.php archive
(this is assuming you don’t have a folder called “archive” — if you do, you’ll need to pick a different name
2. Edit your .htaccess file to add these lines:
# force archive file to be read as PHP
3. chmod 744 .htaccess — this will keep WP from overwriting your .htaccess file
4. In the WP Permalink Options screen, set your URL structure like this:
If you used a filename other than “archive,” change the first bit of that line above.
Then hit “Update Permalink Structure.” WP will tell you to modify your .htaccess file now — ignore it. You’re already all done.
Now what happens is that anytime someone enters an archive URL, it will get interpreted as the *file* “archive” — which is the same as index.php. Just remember, if you update index.php, to copy it over to the “archive” file again.
WP designers: You might consider making future versions of WP work this way. Those rewrite rules are *gnarly*!
- The topic ‘Easier permalinks solution.’ is closed to new replies.