php - Redirect without telling the browser -


i have created responsive website using template @ w3layouts.com. supports desktop, java phones, smartphones.

so, can download template website see how works. first sees if user using pc, java mobile or smartphone. , if on pc php variable $browser_t set web, if user on mobile variable set mobile , if user on smartphone variable set smartphone. in template there 3 folders web, mobile, smartphone. template index.php checks users device , includes specific file in specific folder i.e web, mobile or smartphone. e.g if on mobile user asks www.mysite.com/hello.php .htacces file go index.php , index.php include www.mysite.com/mobile/hello.php.

but want use requests in website changed index.php file send header like:

header('location: mysite.com/'.$browser_t.'/'.$page_name); 

$page_name variable holds 'hello.php' part of url.

but problem don't want user know how url changed. there way redirect different page without telling users browser page redirected.

it's not appreciated can use trick. create different index files including 1 index.php, index_main.php , index_mobile.php . in index.php file use code

switch ($browser_t){     case "<your main view case>":         include "index_main.php";         break;     case "<your mobile view case>":         include "index_mobile.php";         break;     # , on } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -