我有一个多语言网站 我想:如何将网站的子文件夹重定向到一个页面
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
我有一个多语言网站 我想:如何将网站的子文件夹重定向到一个页面
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
有一个名为的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">
我发现另一个网站 在.htaccess文件的答案,我写道:
RewriteEngine On
RewriteRule ^nl/?$ https://exemple.be/nl/nl-start.php
RewriteEngine On
RewriteRule ^fr/?$ https://exemple.be/fr/fr-start.php
我认为,一种语言的网站查看您的网址是什么?如果是你可以通过锚标签或使用javascrip或PHP使用url重定向功能 –
可能重复[如何配置Apache2重定向URL](https://stackoverflow.com/questions/4596066/how-to-config- Apache2的对重定向的URL) – pucky124