There is a server on Xenial 16.04 , installed laravel , I redirect from /project_name/public to /project_name/ :/etc/apache2/sites-available/project_name.conf
<VirtualHost *:80> ServerAdmin admin@your_domain.com DocumentRoot /var/www/html/project_name/public/ ServerName your_domain.com ServerAlias www.your_domain.com <Directory /var/www/html/project_name/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your_domain.com-error_log CustomLog /var/log/apache2/your_domain.com-access_log common </VirtualHost> /var/www/html/project_name/.htaccess :
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> What did you do:
changed .htaccess :
RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteCond %{REQUEST_URI} !project/public/ RewriteRule (.*) /project/public/$1 [L] and in the config:
DocumentRoot /var/www/html/project_name/ Redirect permanent your_domain.com/ your_domain.com/public/ But all in vain.
DocumentRoot /var/www/html/project_name/public/site root. And opening the main site you get into this folder, and not in theproject_name. You will not make a redirect in theproject_name, since it is not accessible from the outside and this is correct. - Visman/var/www/html/project_name/- Tarasovychpublicfiles should look into the world, everything else should be hidden. - Visman/project_name/, but byproject_name/public. I renamedserver.phpintoindex.phpin the root of the project - it helped, but in this case, as far as I understand, allassetswill need to be changed - Tarasovych