Hello.
I have two strings like:
http://localhost/web/
and
http://localhost/web/category/
which sometimes become:
http://localhost/web/2/
, http://localhost/web/3/
etc....
and
http://localhost/web/category/2/
, http://localhost/web/category/3/
etc...
I want to make a verification and:
If the link is http://localhost/web/
it remains the same.
If the link is http://localhost/web/2/
it becomes http://localhost/web/
If the link is http://localhost/web/category/
it remains the same.
If the link is http://localhost/web/category/2/
it becomes http://localhost/web/category/
I guess it should be done using preg_replace()
and preg_match()
.
How can I do it?
Thanks.