Php htaccess重写工作,但不是所有规则

Php htaccess重写工作,但不是所有规则,php,.htaccess,url-rewriting,Php,.htaccess,Url Rewriting,这些是我在.htacces文件中的规则 Options -MultiViews # Turn Rewrite Engine On RewriteEngine on # Rewrite for login.php RewriteRule ^Login login.php [NC,L] # Rewrite for myaccount.php RewriteRule ^Myaccount myaccount.php [NC,L] # Rewrite for index.php RewriteR

这些是我在.htacces文件中的规则

Options -MultiViews

# Turn Rewrite Engine On
RewriteEngine on

# Rewrite for login.php
RewriteRule ^Login login.php [NC,L]

# Rewrite for myaccount.php
RewriteRule ^Myaccount myaccount.php [NC,L]

# Rewrite for index.php
RewriteRule ^Home index.php [NC,L]    

# Rewrite for post-images.php?post=xxxx
 RewriteRule ^Postimages/([0-9a-zA-Z_-]+) post-images.php?post=$1 [NC,L]
除了最后一条规则外,所有规则都很有效。如果我直接使用url,但不使用url,post-images.php页面就可以完美工作。它的表演

找不到

在此服务器上找不到请求的URL/postmages/135


此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。

嗯,我尝试编辑您的重写规则,并对其进行编辑以生成此规则:

RewriteRule ^Postimages/(.*)$ http://www.yourwebsite.com/post-images.php?post=$1 [R=301,L]

它适合我,你介意试一试吗?

这个问题与PHPrewrite规则无关,它在我以前的服务器上运行得很好。现在,在我将工作脚本移动到新服务器后,它无法正常工作。所以我想知道这是因为php版本还是其他原因。。这就是我提到的php关键字。