Error 500 in Ubuntu Server 18.04 when running the .htaccess (url friendly)

0

I have my .htaccess configured with the following lines

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}/index.php [L]

But when you try to access the friendly urls, you mark 404 error
That only happens in Ubuntu Server 18.04 with apache2 and php7.2, I have run it from XAMPP and other servers and it works perfectly.
The following url is an example.

ip_server / apidata / user

    
asked by Gabriel Moreno Reyes 03.12.2018 в 06:11
source

1 answer

0

I guess you have not activated the mod_rewrite module for the case in Ubuntu you can run the following command.

sudo a2enmod rewrite
systemctl restart apache2

Then you have to enable the AllowOverride

<Directory /home/www>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

The file can be found in /etc/apache2/apache2.conf then restart the apache again and try again, now if this does not solve the problem you can send the apache log that is in / var / log / apache2 / error.log

    
answered by 03.12.2018 в 13:10