Reputation: 939
Following rule doesn't work for subfolder rewriting.
RewriteRule ^cat/([0-9a-zA-Z]+) cat.php?id=$1
RewriteRule ^cat/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) cat.php?id=$1&sid=$2
For example With this rule
<?php
$id='News';
$sid='Politics';
?>
<a href="cat/<?php echo $id?>/<?php echo $sid?>">..</a>
In next page, while echoing $_GET['sid']
, it doesn't work
Notice: Undefined index: sid in ...
But this rule
RewriteRule ^cat/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) cat.php?id=$1&sid=$2
works, if only there is two querystring parameters
<a href="cat/<?php echo $id?>/<?php echo $sid?>">..</a>
but it generate ERROR 500
if there is only one parameter
<a href="cat/<?php echo $id?>>..</a>
Upvotes: 1
Views: 44
Reputation: 7476
Try with below,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^cat/([0-9a-zA-Z]+)$ cat.php?id=$1 [L]
RewriteRule ^cat/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ cat.php?id=$1&sid=$2 [L]
Upvotes: 2