passing URL vars to a wordpress page and pretty-fying it with .htaccess
- by Jonah
I have wordpress installed in a directory called welcome, and /welcome/samples is a "page" (created via Wordpress). It's has a php template waiting for a $_REQUEST['category']
When a user goes to /welcome/samples/fun, I want to have "fun" passed to the samples php template in the form welcome/samples/?category=fun
But I want the URL to remain in its original form - it's currently replacing the it with the ugly "?cat...etc"
# Outside the wordpress block so it won't be overwritten
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^samples/([^/]+)$ /welcome/samples?cat=$1 [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /welcome/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /welcome/index.php [L]
</IfModule>
# END WordPress
I tried Rewriting with simply samples?cat=$1 but I was getting a 404. I tried putting in the RewriteBase /welcome/ in the first block. without the [R] flag it doesn't work at all. I keep trying different permutations... and failing:(
Perhaps I'm missing some basic concepts... thanks if you take the time to even read through this:)
ciao