URL shortening in address bar

I am new to html. Is it possible to use Short URL for applications? for example: - instead of the long URL "www.abc.com \ x \ y \ z \ a" we have "www.abc.com \ r" in the user’s address bar. can we emulate this using javascript?

+4
source share
3 answers

Are you looking for url rewriting

read rewrite url in ASP.NET

Beginner URL Redirection

+1
source

Yes, you could create a document at location /r and add Javascript to this document, which simply does:

 document.location.href = "/x/y/z/a"; 

But for many reasons you should not.

  • This is not a redirect (you can return to your browser, so you basically break your story).
  • You rely on javascript
  • This will have a negative impact on SEO.
  • He is slower
  • ...

You really should try to handle this on the server side of your application.

+1
source

This is done using a database that receives a long Short URL, so you can only note it on Clientside using Javascript.

0
source

Source: https://habr.com/ru/post/1433303/


All Articles