What’s wrong with WordPress’ default rules? They work great for me.
Thread Starter
rander
(@rander)
What is wrong with them is, that if I make .htaccess writable and let WP write the rules, noone can access anything in my blog – they get a 403 Forbidden…
Let’s say that your theme dir is /wp-content/themes/peachy/. Add a rule like this:
RewriteCond /wp-content/themes/peachy/%{REQUESTFILENAME} -f [NC]
RewriteRule ^(.*)$ /wp-content/themes/peachy/$1 [L]
The rule that you had won’t work because the request doesn’t match ^/$. If you changed that part to be ^.*$, then it’d work.
Say what?
The new mod_rewrite rules you used, which by the way will be the default in the new WordPress 1.6, should actually do the following for each request:
# Is the IRI a real file?
# If yes, then exit from the rewrite engine
RewriteCond %{REQUEST_FILENAME} !-f
# Is it the IRI a real directory?
# If yes, then exit from the rewrite engine
RewriteCond %{REQUEST_FILENAME} !-d
# Else prefix the request IRI with to /index.php (so WordPress will handle it internally, PHP-wise)
RewriteRule ^(.+)$ /index.php/$1
So there shouldn’t be any problems.
Thread Starter
rander
(@rander)
Mathias, thanks for the run-down. Although it didn’t solve my problem the way I expected it to, it did set me off in a new direction…
So, I have now placed my file in WPs root, and put include ("$_SERVER[DOCUMENT_ROOT]/wp-blog-header.php"); in the first line of my code (as I ofcourse needed the theme-layout and sidebar) – and NOW it works like it should!
And before anyone asks: The reason I put it in the root is, that the above included file in itself includes some other files, which would fail if I did not put it in the WP-root…