Apache 使用htaccess搜索引擎优化友好的url问题

Apache 使用htaccess搜索引擎优化友好的url问题,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我的htaccess有问题 我的非seo友好url如下所示 http://localhost/mybb/index.php?url=login/register http://localhost/mybb/login/register/step/1 代码是 Options -MultiViews RewriteEngine On RewriteBase /mybb/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILEN

我的htaccess有问题

我的非seo友好url如下所示

http://localhost/mybb/index.php?url=login/register
http://localhost/mybb/login/register/step/1
代码是

Options -MultiViews
RewriteEngine On
RewriteBase /mybb/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
然后返回
http://localhost/mybb/login/register
这绝对没问题,现在我正在尝试修改url,如下所示

http://localhost/mybb/index.php?url=login/register
http://localhost/mybb/login/register/step/1
原始url是

http://localhost/mybb/index.php?url=login/register&step=1
我试过这个

RewriteRule ^(.+)$ index.php?url=$1&step=1$ [QSA,L]
它与包含步骤作为参数的url一起工作,但是如果url中没有“步骤”,那么它就不工作。只有当实际url包含名为“步骤”的参数时,才可能在seo url中添加/step/1。谢谢

已解决

最后一行应该是

RewriteRule ^(.*)/(.*) index.php?url=$0&step=$2 [L,QSA] 

然后关闭
RewriteCond%{REQUEST_FILENAME}-l

看看是否是您要找的……谢谢。实际上,这就是我现在正在做的,但我想添加一个额外的参数,即…/register/step/1Pretty close,但我认为我遗漏了一个小东西,但无法跟踪什么。现在一切都好了。谢谢。