今天整了一下 apache的 rewrite功能,在写.htaccess时,发现一个问题折腾了半天
RewriteEngine On
RewriteBase /works/csfx/
#RewriteRule ^left\.html$ [color=red]/index.php[/color] 有斜杠时就不能正确的跳转,提示404错误了,去掉了就正常了.真怪 即使直接用 http://localhost//works/csfx//index.php 访问也正常
RewriteRule ^left\.html$ index.php
RewriteEngine On
RewriteBase /works/csfx/
#RewriteRule ^left\.html$ [color=red]/index.php[/color] 有斜杠时就不能正确的跳转,提示404错误了,去掉了就正常了.真怪 即使直接用 http://localhost//works/csfx//index.php 访问也正常
RewriteRule ^left\.html$ index.php
本文探讨了在配置Apache服务器的.htaccess文件时遇到的问题,特别是关于使用带有斜杠的重写规则导致页面无法正确跳转的情况。通过实验发现去掉斜杠后可以正常工作。
394

被折叠的 条评论
为什么被折叠?



