Lo básico para crear un
virtualhost con
.htaccess habilitado y
mod_rewrite. Si lo hacemos en
Apache2 creamos un archivo nuevo en
/etc/apache2/sites-available/ y le llamamos por ejemplo
wiki.7throot:
NameVirtualHost *
<VirtualHost *>
ServerAdmin info@7throot.com
DocumentRoot /var/www/htdocs/wiki.7throot.com/
ServerName wiki.7throot.com
ErrorLog /var/www/logs/wiki.7throot-error.log
CustomLog /var/www/logs/wiki.7throot-access.log combined
RewriteEngine on
</VirtualHost>
Despues del
RewriteEngine on irían las
RewriteRules dependiendo de lo que queramos modificar, pero si además necesito que ese mod_rewrite lleve implícitos ficheros .htaccess con las reglas simplemente añado ésto:
<Directory /var/www/htdocs/wiki.7throot.com/>
AllowOverride All
</Directory>
Ojo, hay que repetir la ruta en la directiva Directory. El ejemplo completo podría ser éste:
NameVirtualHost *
<VirtualHost *>
ServerAdmin info@7throot.com
DocumentRoot /var/www/htdocs/wiki.7throot.com/
ServerName wiki.7throot.com
ErrorLog /var/www/logs/wiki.7throot-error.log
CustomLog /var/www/logs/wiki.7throot-access.log combined
RewriteEngine on
<Directory /var/www/htdocs/wiki.7throot.com/ >
AllowOverride All
</Directory>
</VirtualHost>
Una vez tenemos el archivo vamos a habilitar el sitio y reiniciar el apache:
# a2ensite wiki.7throot
# /etc/init.d/apache2 reload
Comentarios
# /etc/init.d/apache2 reload
* Reloading web server config apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Mon Nov 03 14:56:05 2008] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[ OK ]
le he cambiado el
pero nada