htaccess does not work with Virtual host with Xampp

0

I have an error with the local server, it does not work with the .htaccess friendly urls, before I used mamp pro and did not ask for anything, now in ubuntu 16.04 I have mounted a server with XAMPP, for the friendly urls I had to mount VirtualHost, I have activated the rewrite module

LoadModule rewrite_module modules/mod_rewrite.so

but still does not work, in the folder I have .htaccess with

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php/error404
</IfModule>
AddOutputFilterByType DEFLATE text/css text/html text/plain text/xml text/javascript application/javascript
<ifmodule deflate_module.c>
    DeflateCompressionLevel 1
    DeflateBufferSize 8096
    DeflateMemLevel 8
    DeflateWindowSize 8

    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/javascript
</ifmodule>

I am always loading the page of error404 by the! mod_rewrite.c and in the httpd-vhosts.conf I have nothing to prevent using the htaccess.

#localhost
<VirtualHost *:80>
    ServerAdmin you@localhost
    DocumentRoot /opt/lampp/htdocs
    ServerName localhost:80
    ErrorLog logs/localhost-error_log
    CustomLog logs/localhost-access_log common

</VirtualHost>

#seiku.es
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /opt/lampp/htdocs/seiku/codeigniter
    ServerName seiku.es
    ServerAlias www.seiku.es
    ErrorLog logs/seiku-error_log
    CustomLog logs/seiku-access_log common

</VirtualHost>

Any help will be appreciated.

    
asked by Kvothe96 02.09.2016 в 03:02
source

1 answer

1

What is happening is that in your file .htaccess there is a direcitva that says "if the module mod_rewrite.c is not loaded, show me the page of error 404 .

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php/error404
</IfModule>

Therefore ... module mod_rewrite.c is not loaded .

In Apache2 the modules are loaded with a soft link from /etc/apache2/mods_availabe/ to /etc/apache2/mods_enabled If you do not have the link to mod_rewrite in the enabled directory, there is the problem. Or if you have not restarted apache after modifying the configuration:

sudo /etc/init.d/apache2 reload
    
answered by 02.09.2016 / 22:29
source