小编Geo*_*ith的帖子

.htaccess RewriteRule 查询字符串的路径

我正在尝试实现这样的网址

example.com/path1到example.com/index.php?p1=path1

example.com/path1/path2到example.com/index.php?p1=path1 & p2 = path2

在我的 .htaccess 中我有:

RewriteEngine On

RewriteRule ^(.*)/(.*)$ /index.php?c=$1&g=$2 [NC,L]

RewriteRule ^([a-zA-Z0-9-_]+)$ /index.php?g=$1 [NC,L]

对于example.com/path1/path2的情况,它效果很好,但对于example.com/path1的情况,只有在 url 中没有点的情况下才有效。例如,我想要 example.com/mydomain.com 工作到 example.com/index.php?g=domain.com 但我无法使其工作。

你能帮我解决这个问题吗?

.htaccess mod-rewrite

3
推荐指数
1
解决办法
2165
查看次数

标签 统计

.htaccess ×1

mod-rewrite ×1