1

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

1 Answer 1

1

This seemed to work for me:

RewriteRule ^welcome/samples/([^/]+)$ /welcome/samples?cat=$1

I noticed that you're matching on ^samples… but actually there's no RewriteBase yet, so you need to match more (^welcome/samples…)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .