I'm using the code below to redirect the url below :
to
www.example.com/index.php?cod=100
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?cod=$1 [L]
It works, but what if i want to redirect this url :
to :
You'd need to add another rule which handles this more specific request before the rule you already have in place. Something like that:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# https://www.example.com/100/200
RewriteRule ^(\d+)/(\d+)/?$ index.php?cod=$1&othercod=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# https://www.example.com/100
RewriteRule ^(\d+)/?$ index.php?cod=$1 [L]