Apache2 CentOS 6
我试图找出如何使Apache VHost将其所有请求发送到索引页作为一种引导。 我不希望改变URL的外观,但所有的请求应该调用相同的index.php文件..
http://url.com/one http://url.com/ http://url.com/one/two/three
上面的例子都应该在索引页上。
谢谢你的帮助..我的大脑受到了伤害
编辑:我似乎得到的地方,直到我冲浪到现有的目录..在这一点上,重写规则似乎不工作..
谢谢,
<VirtualHost *:80> ServerName project_boot DocumentRoot /var/www/html/project_boot <Directory "/var/www/html/project_boot"> AllowOverride None RewriteEngine On RewriteRule ^/.*$ /index.php [QSA,L] </Directory> </VirtualHost>
请指导人们到当前的文档!
上面的“解决scheme” 具体地导致了一个[R] edirect – 这不是OP想要的。
在你的虚拟主机之外:
LoadModule rewrite_module modules/mod_rewrite.so
在你的虚拟主机里面:
AllowOverride None RewriteEngine On RewriteRule ^/.*$ /index.php [QSA,L]
allowoverride禁用可能存在的任何.htaccess文件,并且QSA将任何现有的查询string追加到新的URL(如果这是你想要的)。
(未testing)
RewriteEngine on RewriteRule ^/.* /index.ph [R]
阅读http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
干杯。