[英]Apache rewrite rules issue
Below are the contents of my apache conf files. 以下是我的apache conf文件的内容。 I am expecting the following behavior:-
我期望以下行为:-
Could someone give feedback on what i am doing wrong. 有人可以就我做错的事情提供反馈。 As far as i understand RewriteRule is context aware and these should work as expected.
据我了解,RewriteRule具有上下文意识,这些应该可以正常工作。
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mylocalhost"
ServerName www.mywebsite
# Other directives here
RewriteEngine on
RewriteRule ^/google$ http://www.google.com/ [R]
</VirtualHost>
Alias /somecode "C:/somecodedir/"
<Directory "C:/somecodedir/">
RewriteEngine on
RewriteRule ^/google$ http://www.yahoo.com/ [R]
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Remove the /
in ^/google
(=> ^google
). 在
^/google
(=> ^google
)中删除/
。
"The removed prefix always ends with a slash, meaning the matching occurs against a string which never has a leading slash. Therefore, a Pattern with ^/ never matches in per-directory context." “删除的前缀始终以斜杠结尾,这意味着匹配是针对永远不会有前导斜杠的字符串进行的。因此,具有^ /的Pattern在每个目录上下文中都不会匹配。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.