I’m currently using the apache code:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Categories + Page:
RewriteRule ^([a-z\-]+)/([a-z\-]+)$ /index.php?category=$1&page=$2
RewriteRule ^([a-z\-]+)/([a-z\-]+)/$ /index.php?category=$1&page=$2
# Categories:
RewriteRule ^([a-z\-]+)$ /index.php?category=$1
RewriteRule ^([a-z\-]+)/$ /index.php?category=$1
which turns my urls from:
example.com?category=software&page=mobile
into
example.com/software/mobile/
Which works fine, and the php file is able to $_GET[‘category’] fine; however, for some reason, it does not recognize the $_GET[‘page’]; it just results in it being empty every time.
I’m not the best when it comes to Apache code, so would anyone be able to tell me where I went wrong with it?
The code I’m using for php to get the variables is simply:
$category = $_GET['category'];
$page = $_GET['page'];
Also, if anyone could help me optimize it so that it could work for any number of parameters, that would be even better.
Thanks!
Adding QSA may help