我想执行这个规则:
RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
但我得到的是:
But what I get is:
apps/var/www/vhosts/apps/httpdocs/iphone/home.php?featurez=1
我试图与PT标签战胜它......但没有上有:(效果..什么问题,如何解决这个问题呢。
I tried to overcome it with PT tags...but nothing has an effect on it :(..whats the problem and how do I solve it..
推荐答案当你离开过你的规则的目标的斜线,当Apache需要猜测的路径是否是一个URI路径或文件路径,猜测错误。你可以帮助阿帕奇了通过添加一个斜线(或使目标的绝对URI)或添加重写基地:
When you leave off the leading slash in your rule's target, when apache needs to guess whether the path is a URI path or a file path, it guesses wrong. You can help apache out by either adding a leading slash (or making the target an absolute URI) or adding a rewrite base:
RewriteBase /iphone/ RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
(或任何基本URI是你的要求)
(or whatever the base URI is for your request)
或改变目标绝对URI:
Or change the target to an absolute URI:
RewriteRule ^featured$ /iphone/home.php?featurez=1 [L,NC,PT,R=301]这是假设你的htaccess文件坐在目录iphone您的文档根目录里,并访问你去 HTTP重定向://your.domain/iphone/featured 。否则,刚刚摆脱所有的 iPhone / 的东西。
This is assuming your htaccess file is sitting in the directory "iphone" inside your document root, and to access the redirect you go to your.domain/iphone/featured. Otherwise, just get rid of all the iphone/ stuff.
更多推荐
重写与htaccess的规则,重定向301
发布评论