1

I am trying to use .htaccess url rewrite to transform the url:-

before: http://mydomain.com/en/Home

after: http://mydomain.com/index.php?page=en/Home

I know at .htaccess level, I shall prepare these:-

RewriteEngine On
RewriteBase /
RewriteRule ^$ index.php?page=$X [L]

but I have no idea on how to put en/Home into $X and put it to the after version.

4

2 回答 2

0

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+/.+)$ /index.php?page=$1 [L,QSA]
于 2013-07-09T05:05:26.803 回答
0

你需要建立一个匹配类

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?page=$1 [L]
于 2013-07-09T04:35:54.793 回答