Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda