【发布时间】:2019-09-13 11:32:31
【问题描述】:
我有以下网址
http://localhost/apps/site/index.php?lang=es
我想使用 .htaccess 使其如下所示
http://localhost/apps/site/es
.htaccess 规则
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+?)/?$ /index.php?lang=$1 [L,QSA]
</IfModule>
当我尝试这个网址时http://localhost/apps/site/es
直接将我重定向到http://127.0.0.1/dashboard/
我已经尝试过这个解决方案,但对我不起作用:
【问题讨论】:
-
您能告诉我们您是如何编写重写条件规则的吗?
-
@catcon 请检查我的问题,我已经添加了我的 htaccess 规则。
-
当我尝试这个 url localhost/apps/site/es 直接将我重定向到 127.0.0.1/dashboard 时,为什么我觉得你在其他地方有另一个重写,它在你之前运行..跨度>
标签: php .htaccess mod-rewrite url-rewriting