Get the App
SLTechnology News&Howtos  ›  Development  › 

How to delete index.php and hide parameter keys from URL by htaccess

Shulou Source: shulou.com Published: 2022-06-01 05:53:05 09月29日 Update

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!

Tags: Characters parameters strings content functions more knowledge practicality learning next code dilemma reality situation articles cases blanks ribbons websites industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux Huawei Docker Redmi