[英]htaccess rewrite working but not all rules
这些是我在.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而不是rewriteurl,则post-images.php页面将完全正常工作。 其显示
未找到
在此服务器上找不到请求的URL / PostImages / 135。
此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。
嗯,我尝试编辑您的RewriteRule并对其进行编辑以使其符合以下规则:
RewriteRule ^Postimages/(.*)$ http://www.yourwebsite.com/post-images.php?post=$1 [R=301,L]
它对我有用,您介意尝试吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.