如果没有斜杠,我拥有的重写 url 不会重定向。我想将去这里的用户重定向http://example.com/po
到这里:http://new.example.com/po/index_mi.php
。
我尝试了这些行,但没有一个行得通:
RewriteRule /po(/)?$ http://new.example.com/po/index_mat.php [R=301,L]
RewriteRule ^/po(/)$ http://new.example.com/po/index_mat.php [R=301,L]
RewriteRule ^/po$ http://new.example.com/po/index_mat.php [R=301,L]
这是完整的虚拟主机:
<VirtualHost 192.228.100.142:80>
ServerAdmin serveradmin@example.com
DocumentRoot /home/drupal_1
ServerName example.com
ServerAlias www.example.com
Alias /movies /home/movies/
ErrorLog /var/log/httpd/example.com_err_log
CustomLog /var/log/httpd/example.com_log special
<Directory /home/drupal_1>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
</Directory>
# Rewrite Rules #####################
RewriteEngine On
RewriteRule ^/webmedia/(.*) / [R=301,L]
RewriteRule ^/marquee.php / [R=301,L]
RewriteRule ^/register /user/register [R=301,L]
RewriteRule ^/po(/)?$ http://new.example.com/po/index_mat.php [R=301,L]
# end Rewrite Rules #################
</VirtualHost>
更新:
我让它与这条线一起工作:
RewriteRule ^/po$ http://new.example.com/po/index_mat.php [R=301,L]