這裏exacly相同的路徑是什麼,我試圖做的:重定向到具有不同勢languge
任何網頁的客戶開放腳本將他重定向到他從$_SERVER["HTTP_ACCEPT_LANGUAGE"];
例如閱讀首選語言: 客戶瀏覽器以西班牙語設置。如果他打開網頁http://example.com/script-name.php?param1=aa¶m2=bb
比腳本將他重定向到http://example.com/es/script-name.php?param1=aa¶m2=bb
我有腳本,它提供給我指將其排序
比我腳本讀取地址
瀏覽器$lang=substr(Get_Client_Prefered_Language(),0,2);
的語言
$location = '';
parse_str(html_entity_decode($_SERVER['QUERY_STRING']),$query_string);
if(isset($query_string['language'])) {$query_string['language'] = null;}
$new_query_string = !empty($query_string) ? http_build_query($query_string) : '';
if($new_query_string != ''){$location .= '?'.$new_query_string;}
並提供給我新的地址:
$location="https://macrohosting.co.uk/".$lang.$_SERVER["SCRIPT_NAME"].$location;
,比我可以使用header('location: '.$location);
所有工作得很好,但有些我已經URL rewrited頁面。
而且不知道如何調整上面的腳本,所以當客戶訪問http://example.com/page1.htm
比將被重定向例如以http://example.com/es/page1.htm
如果沒有修改客戶被重新導向http://example.com/es/page_example.php?param=aa¶m=bb
您使用什麼webserver進行重寫? Apache還是Nginx? –
我正在使用LiteSpeed – Solver