我使用以下代码在我的服务器上输入.htaccess文件:
RewriteEngine on
RewriteRule ^([a-z0-9-]+)? index.php?i=$1 [L]
当我跑步时,我有这样的事情:
http://example.com/index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.phpi=index.php?i=XYZ
如何获得链接如下:
http://example.com/index.php?i=XYZ
来自链接的看起来像这样
http://example.oom/XYZ/ABC/123
我只需要第一个XYZ到index.php?i=XYZ
答案 0 :(得分:0)
工作代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([^/.]+)?$ index.php?i=$1 [L]
</IfModule>