[英]PHP Codeigniter - Apache virtual host setup trouble
This has been doing my head in. Hope you guys can help. 我一直在努力。希望你们能帮忙。 I can't find out where the error lies.
我无法找出错误所在。
httpd-vhosts.conf 的httpd-vhosts.conf
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot /opt/lampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot /home/tilman/Sites/mysite/www
ServerName mysite.lo
</VirtualHost>
/etc/hosts / etc / hosts文件
127.0.0.1 localhost
127.0.0.1 mysite.lo
config.php config.php文件
$config['base_url'] = "http://mysite.lo";
$config['index_page'] = "";
www/.htaccess WWW /的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
Now http://mysite.lo
shows me the default controller. 现在
http://mysite.lo
显示默认控制器。 http://mysite.lo/index.php
as well. http://mysite.lo/index.php
也是如此。 So does http://mysite.lo/index.php/welcome
. http://mysite.lo/index.php/welcome
。
But http://mysite.lo/welcome
doesn't. 但
http://mysite.lo/welcome
却没有。
http://localhost/mysite/www/welcome
works as expected. http://localhost/mysite/www/welcome
按预期工作。
edit: I want to move system and application out of the web root. 编辑:我想将系统和应用程序移出Web根目录。 So my file structure looks like this:
所以我的文件结构如下:
application/
system/
www/
'- index.php
In index.php I changed the paths to system and application folder, of course. 在index.php中,我当然改变了系统和应用程序文件夹的路径。
Sounds like you're having rewritemod/htaccess issues rather than VirtualHost issues. 听起来你有重写mod / htaccess问题而不是VirtualHost问题。 Have you made sure that you've got a block such as
你有没有确定你有一个块,如
<VirtualHost *:80>
ServerName mysite.lo
<Directory /home/tilman/Sites/mysite>
AllowOverride All
</Directory>
</VirtualHost>
somewhere within your config files? 你的配置文件中的某个地方? The fact that /index.php and /index.php/welcome work, tell me that it's the rewrite mod that's not functioning...
/index.php和/index.php/welcome工作的事实告诉我,这是重写mod无法正常工作......
In your virtual host, do you not need this? 在您的虚拟主机中,您不需要这个吗?
<VirtualHost 127.0.0.1>
DocumentRoot /home/tilman/Sites/mysite
ServerName mysite.lo
</VirtualHost>
I'm not sure you needed the www
portion. 我不确定你需要
www
部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.