这个简单的重写不起作用。我已经在运行linux的服务器上对此进行了测试。 http://www.lokislayer.com/mvc/bob - 页面显示bob就像它应该 -
localhost无法安装xampp:
.htaccess文件
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]enter code here
简单的index.php文件
<?php
$url = $_GET['url'];
echo $url;
?>
来自php的错误消息: 注意:第3行的E:\ XAMPP \ htdocs \ mvc \ source \ index.php中的未定义索引:url
除非我删除第二个RewriteCond,否则代码不起作用。我有mod重写工作,因为在相同的xampp安装我运行MagentoCE 1.8。
答案 0 :(得分:1)
确保将代码放在DOCUMENT_ROOT/mvc/source/.htaccess
中,并让您的代码如下:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /mvc/source/
RewriteRule ^([^.]+)/?$ index.php?url=$1 [QSA,L]
重要的变化是使用RewriteBase