Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache web server configuration gives 404 error message

I've been looking around, but I still couldn't find the solution.

I have this in file apache2.conf:

<Directory /home/pablo/htdocs/elementalguru/cuentas/idpetecuador.com/www/system/public>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

This in file 000-default.conf:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    # ServerName localhost

    ServerAdmin webmaster@localhost
    DocumentRoot /home/pablo/htdocs

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/home/pablo/htdocs/elementalguru/cuentas/idpetecuador.com/www/system/public"
    ServerName eguru.idpet.sys
</VirtualHost>

And the .htaccess file in the public folder is like this:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

But still when I try to access a URL like

http://eguru.idpet.sys/clinicas

Which is stated in the hosts file.

I get a 404 error message.

Why?

like image 990
Pablo Avatar asked Feb 02 '26 13:02

Pablo


1 Answers

Your mod_rewrite should be enabled.

Try a2enmod rewrite on the command line, and then restart Apache.

Try this laravel/laravel .htaccess file:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
like image 52
ryanwinchester Avatar answered Feb 04 '26 02:02

ryanwinchester



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!