Reputation: 3214
I have done mod_rewrite for category.php.
RewriteRule ^category/([A-Za-z0-9-]+)(&type=[A-Za-z0-9-]+)?(&r=[A-Za-z0-9-]+)?(&g=[A-Za-z0-9-]+)?(&v=[A-Za-z0-9-]+)?(&page=[A-Za-z0-9-]+)?/?$ /category.php?c=$1&type=$2&r=$3&g=$4&v=$5&page=$6 [L]
With this url in the browser;
http://localhost/category/general
I test if v
exists
if(isset($_GET['v'])) {
echo "yes";
}
yes
is displayed but it isn't in the url? If the url was this..
http://localhost/category/general&v=1
then yes
should be displayed. How do i fix this?
Upvotes: 0
Views: 198
Reputation: 16828
You are always calling category.php
with c=$1&type=$2&r=$3&g=$4&v=$5&page=$6
as the query string. Using isset()
is inefficient as it will always be set. I would use empty()
instead.
if(!empty($_GET['v'])) {
echo "yes";
}
Upvotes: 1