0
我在本地机器上设置了XAMPP。我开始设置我的MVC,并注意到$ _GET将我的本地目录结构一直返回到驱动器盘符。但是我想返回URL结构。
我试图提供所有可能的相关信息。
环境
- Windows 7专业SP1 64位
- XAMPP 1.8.1
主机 [C:\ Windows \ System32下\驱动程序\等\主机]
127.0.0.1 www.getspark.com
的httpd.conf [E:\ XAMPP \ apache的\的conf \ httpd.conf文件]
DocumentRoot "E:/xampp/htdocs/home"
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/home
ServerName getspark
</VirtualHost>
<Directory "E:/xampp/htdocs/home/private">
Order deny,allow
Deny from all
</Directory>
<Directory />
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ /index.php?url=$1 [L,QSA]
</Directory>
网站目录结构 [E:\ XAMPP \ htdocs中\家居】
home
index.php
private
controllers
public
graphics
HTML5_Logo_512.png
主页 [E:\ xampp \ htdocs \ home \ index.php | http://www.getspark.com/]
<?php
$url = $_GET['url'];
echo $url . '<br />';
?>
<img src="/public/graphics/HTML5_Logo_512.png" />
如果我使用以下网址:
http://www.getspark.com/foobar
我得到这样的输出:
E:/xampp/htdocs/home/foobar
除了图像。
但我想这样的输出:
foobar
所有相对(绝对)引用正常工作(对于图像,PHP文件,js文件等)。