How to delete index.php and hide parameter keys from URL by htaccess
This article introduces the knowledge of "how htaccess deletes index.php from URL and hides parameter keys". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Introduction to related functions:
The trim () function removes white space or other predefined characters from both sides of the string and returns the modified string.
Syntax: trim (string,charlist)
Parameter description: string? Necessary. Specifies the string to check.
Charlist?? Optional. Specifies which characters are removed from the string. If this parameter is omitted, all the following characters are removed:
Code implementation: function removeqsvar ($url, $var_names) {
Foreach ($var_names as $param) {
$url=preg_replace ('/ ([? &])'. $param.'= [^ &] + (& | $) /','$1)
}
Url=trim ($url, "?")
$url=trim ($url, "#")
$url=trim ($url, "&")
$url=trim ($url, "/")
Return $url
}
This is the end of the introduction to "how htaccess removes index.php from URL and hides parameter keys". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!