.htaccess like that is not needed. everything should be handled by the vhost configuration. the DocumentRoot directive says where are the files served from, so it should work, have you reloaded/restarted apache service after these changes?
Laravel 7 with Apache2 - Virtualhost Config not redirect to public folder
I have a problem when I deploy laravel with apache web server on Ubuntu 20 Server. My apache running on 8080 port. When I access the laravel directory the project is not directed to the public folder. Even though I have made a virtualhost configuration.
<VirtualHost 127.0.1.2:8080>
ServerName admin-baledono.com
ServerAlias www.admin-baledono.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/admin-baledono.com/public
<Directory /var/www/html/admin-baledono.com>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/admin-baledono.com-error.log
CustomLog ${APACHE_LOG_DIR}/admin-baledono.com-access.log combined
</VirtualHost>
I have disabled the default configuration file from virtual host in Apache. And enabled my virtualhost configuration.
I've also created a .htaccess file like this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/ [L]
</IfModule>
But the result is still the same. When I access my website, what is displayed is the contents of my project directory
oh, i see. if you want to access the page on localhost:8080, you need to specify that in the <VirtualHost HERE> directive. because, currently like that, it only "listens" on 127.0.1.2
either add localhost:8080, like this <VirtualHost 127.0.1.2:8080 localhost:8080> (i suppose), or use a wildcard
<VirtualHost *:8080>
...
Please or to participate in this conversation.