我正在尝试实现这样的网址
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 但我无法使其工作。
你能帮我解决这个问题吗?