I created a very responsive website using the template at w3layouts.com. Which supports all desktop, java phones, smartphones.
So, you can download any template from this site to find out how it works. First, he sees if the user is using a computer, mobile Java or a smartphone. And if it is on a PC, the php $ browser_t variable is set to the network, if the user is on a mobile phone, the variable is set to mobile, and if the user is on a smartphone, then the variable is set to the smartphone. There are three folders in the template: web, mobile, smartphone. The index.php template checks the user device and then includes a specific file in a specific folder, for example, on the Internet, mobile or smartphone. for example, if a user requests www.mysite.com/hello.php on a mobile phone, the .htacces file will go to index.php, and index.php will include www.mysite.com/mobile/hello.php.
But I want to use receive requests on my website, so I changed the index.php file to send the header, for example:
header('Location: mysite.com/'.$browser_t.'/'.$page_name);
$ page_name is a variable that contains the hello.php portion of the URL.
But the problem is that I do not want the user to know how the URL has changed. So there is a way to redirect to another page without telling the browser browser that the page has been redirected.
source
share