0

我的 mods_rewrite 规则有问题。我目前在 .htaccess 文件中有这个。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

我想通过网站访问这个网址。

http://domain.com/activate/?key=3459ae01bd5f5564a49a31ad373bf998

我知道它是第一个重写规则,因为我把它拿出来并且激活有效。你们能帮忙吗?

4

1 回答 1

1

您不需要 2 条规则,它可能会破坏您的 WordPress 这样做。

你可以试试这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^activate/$ /inddex.php [QSA,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

在您的浏览器上,您将看到

http://domain.com/activate/?key=3459ae01bd5f5564a49a31ad373bf998

但在内部它将访问

http://domain.com/index.php?key=3459ae01bd5f5564a49a31ad373bf998

让我知道这是否是你想要的。

于 2013-07-30T03:58:45.963 回答