Right, here's the deal. I've got a loop of which displays news posts, these posts can belong to special categories (not normal categories) and I want to be able to filter by them.
If I wasn't too interested in aesthetics I'd use a link like this:
domain.com/news?filter=cat1
But instead what I want to do is this (» rewritten):
domain.com/news/cat1 » domain.com/news/?filter=cat1
I've modified the .htaccess
to pass the cat1
value as a GET variable:
RewriteEngine On
RewriteBase /
RewriteRule ^news/(.*)/$ /news/?filter=$1 [L,QSA]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The problem is even though this is now successfully passing the filter
variable in, WordPress treats the /cat1/
as a page, it obviously cannot find it and thus throws a 404.
Is there a way to allow this particular URL rewriting without WordPress firing a 404? It appears it's taking the URL in the address bar and parsing that, what I really want is for it to parse the rewritten URL.
Thanks