I want to know how to encrypt the URL on Apache/PHP?
For example:
www.example.com/how-to-encrypt.html
to
It's best to perform security operations at the database level. Here is how to perform MySQL database operations using PHP: PHP Database Operations with MySQL. Then, you have access to all of the database operations related to security, such as: Encryption and Compression Functions. Thus, you can generate the string in the database and pass a token in a URL parameter to the user. It is best to also pass another parameter, such as a username, into the URL to reduce security risk. Upon client response, you just grab the parameters from the url and validate the user. Be sure to sanitize and validate input before performing the database operation. Sanitize and validate before assuming data is safe.
And for information, you should never use JavaScript to perform important security operations, at least not without seriously evaluating the risks and alternative options. (Any hacker will see your entire security logic in the JavaScript code.)
Notice that you can grab the _ylt & _ylu parameters from this url:
Those parameters are what you will grab for your database operation. You could use these in a particular page like this: