I would like to be able to get or detect all spaces of the %20
y type +
in the url, and replace them with -
using JavaScript.
I have this regex /[\s\%20\+]/g
but I don't know if it really works, I don't know much about regular expressions xD.
Example with +
:
http://miurl.com/mi+url+web
And I want it to be like this:
http://miurl.com/mi-url-web
Example with %20
:
http://miurl.com/mi%20url%20web
And I want it to be like this;
http://miurl.com/mi-url-web
Example with +
and %20
:
http://miurl.com/mi+url%20web
And I want it to be like this:
http://miurl.com/mi-url-web
Here I add my hashed urls:
http://miurl.com/#!mi+url%20web
And I handle them with the event hashchage
and normally I mean reloading the page completely manually, only when correcting the urls with -
it creates an infinite redirection. I created a code referring to the one shown here, but doing it with window.location.hash
makes me infinite redirect.