How can I make the last parameter of my url dynamic when I have more then 1 parameters
For instance: http://localhost:8080/series/dynamics/testurl/Shoes/Sports
has 2 parameters namely "shoes" & "Sports". What I would like to achieve is keep Shoes as a static parameter & "Sports" as dynamic parameter which can be changed further to "Running","Tennis" or "Casual". Below is how I have defined the links in php:
<a href="<?php echo 'Shoes'.'/'.$var2; ?>">Sports</a><br/>
<a href="<?php echo 'Shoes'.'/'.$var2; ?>">Running</a><br/>
<a href="<?php echo 'Shoes'.'/'.$var3; ?>">Tennis</a><br/>
<a href="<?php echo 'Shoes'.'/'.$var4; ?>">Casual</a><br/>
While trying to achieve it through above code & htaccess my problem is as soon as an user clicks on Tennis while on "Sports" the url changes to below:
http://localhost:8080/series/dynamics/testurl/Shoes/Shoes/Tennis
Or even if when I click on the sports link for a 2nd time it changes to:
http://localhost:8080/series/dynamics/testurl/Shoes/Shoes/Sports
as a result I am getting 404 Not found error. Hence I am hoping there must be way to keep the 1st parameter staic and only 2nd parameter dynamic. I know its not a very classic way of doing things but I have gon to elementary level in order to be able narrow down on my errors but no luck yet !!!
I checked various sources but nothing was helpful to resolve my problem. Please guide me in the right direction.
.htaccess looks like this:
RewriteEngine On
RewriteBase /series/dynamics/testurl/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]+)/?$ test.php?page=$1 [L,NC,QSA]
RewriteRule ^([a-zA-Z]+)/([^/]+)/?$ test.php?page=$1&subgroup=$2 [L,NC,QSA]