Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
Apache configure ServerPath for CodeIgniter

I'm very new to Apache and CodeIgniter. Trying to route /var/www/html to http://localhost/ and /var/www/CodeIgniter to http://localhost/codeigniter

Apache conf:

<VirtualHost *:80>
    ServerName localhost
    ServerPath /codeigniter
    DocumentRoot /var/www/CodeIgniter
    <Directory /var/www/CodeIgniter>
          Allowoverride All
    </Directory>
</VirtualHost>

CodeIgniter:

$config['base_url'] = 'http://localhost/codeigniter';

http://localhost/codeigniter gives me codeigniter, but http://localhost/ also gives it to me when I expect /var/www/html

What should I change?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Nowhere do you configure your DocumentRoot in the snippet you give - thus we have no clue that you might be serving anything from /var/www/html.

I'd expect a directive DocumentRoot /var/www/html somewhere within your VirtualHost (I prefer such a directive in the VirtualHost, not in the global server configuration). From there on, let's look at the Apache httpd documentation:

There are frequently circumstances where it is necessary to allow web access to parts of the filesystem that are not strictly underneath the DocumentRoot. httpd offers several different ways to accomplish this. On Unix systems, symbolic links can bring other parts of the filesystem under the DocumentRoot. For security reasons, httpd will follow symbolic links only if the Options setting for the relevant directory includes FollowSymLinks or SymLinksIfOwnerMatch.

Alternatively, the Alias directive will map any part of the filesystem into the web space. For example, with

Alias "/docs" "/var/web"

the URL http://www.example.com/docs/dir/file.html will be served from /var/web/dir/file.html.

i.e. I'd expect an Alias, to do the job.

Alias "/codeigniter" "/var/www/CodeIgniter"

All in all, closer to (this is not complete/tested):

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/www/html
  Alias "/codeigniter" "/var/www/CodeIgniter"
</VirtualHost>

(add Options, Directory, other directives and permissions etc. to taste)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda