0

长话短说,我正在尝试重定向:

http://example.com/?_escaped_fragment_=/onetwothree

像这样:

http://example.com/serve.php?_escaped_fragment_=/onetwothree

我正在使用以下 .htaccess 代码:

# Enable Rewriting
RewriteEngine on
RewriteCond %{QUERY_STRING}  _escaped_fragment_=  [NC]
RewriteRule ^(.*)$ http://example.com/serve.php$1 [P,QSA,L]

但反应很奇怪:

Forbidden

You don't have permission to access /serve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpserve.phpindex.html.var on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

难道我做错了什么?我是新手。我将衷心感谢您的帮助。

更新 1

我尝试使用:

RewriteEngine on
RewriteCond %{QUERY_STRING}  _escaped_fragment_=  [NC]
RewriteCond $1 ^serve\.php
RewriteRule ^(.*)$ http://example.com/serve.php$1 [P,QSA,L]

但现在它根本不起作用。当我尝试访问example.com/?_escaped_fragment_=/dfas时,它会将我重定向到example.com/?_escaped_fragment_=/dfas#!而不是example.com/serve.php?_escaped_fragment_=dfas请帮助我,伙计们,我不知道为什么会这样。这对我来说真的很重要。

4

1 回答 1

0

您需要检查您是否已经被重定向到 serve.php:

RewriteEngine on
RewriteCond %{QUERY_STRING}  _escaped_fragment_=  [NC]
RewriteCond $1 !^serve\.php
RewriteRule ^(.*)$ http://example.com/serve.php$1 [P,QSA,L]
于 2014-10-01T19:47:39.760 回答