transform Query String url to a Readable url for the user

Asked

Viewed 155 times

2

I ever noticed that it was possible to turn a query string into something more readable for the user, like this:

real url:

site.com/roupas?categoria=vestidos

for this (what the user sees)

site.com/roupas/vestidos ou site.com/roupas/categoria/vestidos

I also know that the way is through htaccess and have to understand REGEXR to do something +- like this, but I need a foothold to understand how to do this process, if possible turn legible the URL below just for example:

site.com/roupas?categoria=vestidos

And another,.. With this transformation, it won’t get in the way anytime I want to take the parameter for GET right? I mean, it’s just the visual part that changes and the functional part doesn’t?..

1 answer

1

When you use the url with the symbol "?" what comes next are $_GET parameters. I also know that it is possible to change the url via javascript, so yes it is possible to make the url more "readable" for the user, however you must use the variables that come from $_GET first and later change the url with javascript ai yes it will not disturb you when using the variables that comes in the url.

an example with javascript is the command

window.history.pushState()

that I fell for the question Change address bar url without refreshing page

Browser other questions tagged

You are not signed in. Login or sign up in order to post.