I have my website: www.testurl.com. The index.php first checks the client's device and redirects to the mobile version and desktop version accordingly.
However, while getting redirected to the desktop version, I get the url www.testurl.com/index.shtml?redirect=false
. I want to hide the ?redirect=false
part using htaccess. How can I do that? Due to my logic, I can't use post requests.
I'm assuming your index.php put it there because it needs it. You can't simply hide it by using directives in an htaccess file.
I'm going to assume that the redirect=false
query string is to let index.php
know not to redirect again based on the user-agent. So how does rules in htaccess know whether a request has been redirected? It seems like the index.php
needs to be able to look at the version of the site that's being request. If it's a mobile user-agent, and it's accessing the mobile version of the site, don't redirect. If it's a desktop user-agent and it's accessing the desktop version of the site, don't redirect. This way you don't need the redirect=false
query string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.