I have a
RewriteRule ^([^/]+)/id([0-9]+)/?$ /?page=$1&id=$2&location=$3 [L]
I need to make a rule for the part &location=
This part of url &location= is not permanent. The url originally presented without &location= but some links will include with part and I need to add it to the RewriteRule.
I was trying to do this way
RewriteRule ^([^/]+)/id([0-9]+)/([0-9]+)/?$ /?page=$1&id=$2&location=$3 [L]
But in this case the url like this
http://www.example.com/travel/id725
not found without 3-rd parameter. But I need it to work both ways
http://www.example.com/travel/id725
AND
example.com/travel/id725/43
Can you help me with it please?
You can add two different rules. First, when all three parameters are present; and then for the case where only two parameters are present.