PHP Codeigniter - problem with configuring Apache virtual host

It made my head. Hope you guys can help. I can not understand where the error is.

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

 127.0.0.1 localhost 127.0.0.1 mysite.lo 

config.php

 $config['base_url'] = "http://mysite.lo"; $config['index_page'] = ""; 

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/index.php . So http://mysite.lo/index.php/welcome .

But http://mysite.lo/welcome not working.

http://localhost/mysite/www/welcome works as expected.


edit: I want to move the system and application from the root of the network. Therefore, my file structure looks like this:

 application/ system/ www/ '- index.php 

In index.php, of course, I changed the path to the system and application folder.

+4
source share
2 answers

It looks like you have problems with rewritemod / htaccess and not with VirtualHost problems. You have made sure that you have a block like

 <VirtualHost *:80> ServerName mysite.lo <Directory /home/tilman/Sites/mysite> AllowOverride All </Directory> </VirtualHost> 

somewhere inside your config files? The fact that /index.php and / index.php / welcome work, tell me that this is a rewriting mod that doesn't work ...

+9
source

Do you need this in your virtual host?

 <VirtualHost 127.0.0.1> DocumentRoot /home/tilman/Sites/mysite ServerName mysite.lo </VirtualHost> 

I'm not sure you need the www part.

0
source

All Articles