【发布时间】:2017-02-14 19:54:23
【问题描述】:
我的 .htaccess 目前看起来像:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+([^/]+)/\?lang=([^\s&]+) [NC]
RewriteRule ^ /%2/%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]{2})/([^/]+)/?$ $2/?lang=$1 [L,QSA]
这意味着example.com/{lang}/some-page.php 充当example.com/some-page.php?lang={lang}
剩下的问题:example.com/{lang} 不起作用,除非它有 index.php 像 `example.com/{lang}/index.php
当我们直接去example.com/{lang}时,我怎样才能让它工作?
【问题讨论】: