2017-09-18 53 views
0

我有一個多語言網站 我想:如何將網站的子文件夾重定向到一個頁面

exemple.be/nl/

重定向到

exemple.be/nl/start_nl.php 

exemple.be/fr/

重定向到

exemple.be/fr/start_fr.php

我能做到這一點,可能與htaccess的?

我試過了,沒有用:

301 /nl/ https://exemple.be/nl/start_nl.php 
+0

我認爲,一種語言的網站查看您的網址是什麼?如果是你可以通過錨標籤或使用javascrip或PHP使用url重定向功能 –

+0

可能重複[如何配置Apache2重定向URL](https://stackoverflow.com/questions/4596066/how-to-config- Apache2的對重定向的URL) – pucky124

回答

0

有一個名爲的setlocale在PHP函數,可以使用製造它,讓它去與標題(「位置的特定部位:start_nl。 PHP的「);

http://php.net/manual/en/function.setlocale.php

但除此之外,你可以賺那麼這樣的index.php去與標題內的專用網站(「地點:start_fr.php」); 只要把在頂部,打開標籤下的PHP:

<?php 
header("Location: start_fr.php"); 
?> 

它也可以用HTML來完成。

<meta http-equiv="refresh" content="2; URL=start_fr.php"> 
0

我發現另一個網站 在.htaccess文件的答案,我寫道:

RewriteEngine On 
RewriteRule ^nl/?$ https://exemple.be/nl/nl-start.php 
RewriteEngine On 
RewriteRule ^fr/?$ https://exemple.be/fr/fr-start.php 
相關問題