2012-07-18 94 views
-2

我需要用.htaccess重写一个URL。将变量重写为文件夹

(Actual url) Before: yyy.com/folder/index.php?lang=en 
(Their url) After: yyy.com/folder/en/index.php 

Before: yyy.com/folder/submit.php?lang=da 
After: yyy.com/folder/da/submit.php 

我该怎么做?

+0

(http://whathaveyoutried.com) – 2012-07-18 15:54:09

+0

什么都没有。我不知道从哪里开始 – Hedam 2012-07-18 16:02:12

+0

http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html。这需要一个谷歌搜索。 – 2012-07-18 16:50:20

回答

1

尝试在你的文档根目录添加以下内容到htaccess文件:?你尝试过什么]

RewriteEngine On 
RewriteRule ^/?folder/([a-z]{2})/index\.php$ /folder/index.php?lang=$1 [L,QSA]