Mod rewrite Mod_重写帮助

Mod rewrite Mod_重写帮助,mod-rewrite,Mod Rewrite,这就是我所拥有的,但它不起作用 RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews$ location.php?purl=$1&page=reviews [L] RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews/$ location.php?purl=$1&page=reviews [L] 谁能告诉我我做错了什么 到我假设您的conf文件中有另一个名为RewriteEngine on的属性?

这就是我所拥有的,但它不起作用

RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews$ location.php?purl=$1&page=reviews [L]
RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews/$ location.php?purl=$1&page=reviews [L]
谁能告诉我我做错了什么


我假设您的conf文件中有另一个名为RewriteEngine on的属性?
另外,您可以使用RewriteLogLevel打开日志记录。

我假设您的conf文件中有另一个名为RewriteEngine on的属性?
此外,您还可以使用RewriteLogLevel打开日志记录。

您应该将这两个(几乎相同的)规则组合在一起,并确保启用了RewriteEngine,并且正在运行您的规则(您的.htaccess正在接收,或者您的vhost定义处于活动状态)


您应该将这两个(几乎相同的)规则组合在一起,并确保启用了
重写引擎
,并且您的规则正在运行(您的.htaccess正在被拾取,或者您的vhost定义处于活动状态)


我认为这应该适用于您给出的示例URL:

RewriteRule ^([a-zA-Z0-9_-]+)/reviews/?$ location.php?purl=$1&page=reviews [L]
(用此规则替换两个重写规则)

如果您还没有,请在此重写规则之前添加
RewriteEngine on

如果您确实想重写
/location/this-location-1234/reviews/
,而不是
/this-location-1234/reviews/
,请使用以下命令:

RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews/?$ location.php?purl=$1&page=reviews [L]

我认为这应该适用于您给出的示例URL:

RewriteRule ^([a-zA-Z0-9_-]+)/reviews/?$ location.php?purl=$1&page=reviews [L]
(用此规则替换两个重写规则)

如果您还没有,请在此重写规则之前添加
RewriteEngine on

如果您确实想重写
/location/this-location-1234/reviews/
,而不是
/this-location-1234/reviews/
,请使用以下命令:

RewriteRule ^location/([a-zA-Z0-9_-]+)/reviews/?$ location.php?purl=$1&page=reviews [L]

我修好了。我不小心在链接中漏掉了一些措辞,我得到了一个错误

RewriteRule^location/([a-zA-Z0-9_-]+)/reviews/?$location.php?purl=$1&page=reviews[L]


这太棒了

我把它修好了。我不小心在链接中漏掉了一些措辞,我得到了一个错误

RewriteRule^location/([a-zA-Z0-9_-]+)/reviews/?$location.php?purl=$1&page=reviews[L]


这太棒了

什么不起作用?你认为它是如何工作的?试图重写上面的URL。我收到一个“未找到”错误。更新帖子。您忘记了示例URL中的
/location/…
。什么不起作用?你认为它是如何工作的?试图重写上面的URL。我收到一个“未找到”错误。更新帖子。您忘记了示例URL中的
/location/…
。是的,我已在上重写。让我打开日志,看看我是否能找到答案。是的,我已经开始重写了。让我打开日志,看看是否能找到答案。