我有我建立了一个不育系,将节省的语言在一个XML文件,并根据不同的页面,语言选择,它会显示正确的数据一对夫妇的网站。我cuurently对每个站点的8种不同的语言和URL是这样的:
I have a couple websites that I built a CMS for that will save the languages in an XML file and depending on the page and language selector, it will show the correct data. I cuurently have 8 different languages for each of the sites and the urls are like:
leclosdamboise/index.php?lang=fr
leclosdamboise/rooms.php?lang=en
leclosdamboise/hotel.php?lang=de
我想拥有它,这样的URL重写为如下:
I am trying to have it so that the urls are rewritten to look like this:
leclosdamboise/fr/index.php
leclosdamboise/en/rooms.php
leclosdamboise/de/hotel.php
我花了几个小时通过论坛梳理和没有能够找到一个解决方案,工程。我的.htaccess文件现在看起来是这样的:
I have spent hours combing through forums and not been able to find a solution that works. My .htaccess file currently looks like this:
SetEnv PHP_VER 5_TEST SetEnv REGISTER_GLOBALS 0 RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)$ index.php?lang=$1 [QSA,L]这并没有做任何事情,该网址仍是丑陋的继女版。上面的链接是实际联系的地点之一。有一次,我整理了这一点,我需要它deply几个地点,但被伤透我的头试图理清了这一点。谁能告诉我什么,我做错了什么?
This does not do anything and the urls are still the ugly step-daughter version. The links above are actual links to one of the sites. Once I sort this out I need to deply it to several sites, but been racking my head trying to sort this out. Can anyone tell me what I'm doing wrong?
推荐答案这应该工作在一个.htaccess文件的根目录下:
This should work in one .htaccess file at root directory:
Options +FollowSymlinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule .* - [L] RewriteRule ^([^/]+)/([^.]+)\.php /$2.php?lang=$1 [L,NC,QSA]更多推荐
重写PHP友好的URL使用.htaccess文件多种语言
发布评论