Answer the question
In order to leave comments, you need to log in
Laravel 5 httacces and Ubuntu server. Why is the site indexed as site.com/public/index.php?
Good afternoon.
Installed Laravel 5 according to factory instructions. Registered httacces as in the manual. Everything is standard, nothing out of the ordinary. Deployed the app to production.
Now I see that the site has been indexed as site.com/public/index.php, etc. Those. url contains /public/index.php.
If you go to the site.com direct link, then in the address bar I will get site.com/public/index.php and further walking around the site /public/index.php remains in the line.
If I go to the direct link site.com/news and then crawl through the site - public/index.php is no longer in the address. Everything works in both cases.
The site is deployed on its Ubuntu server 14.04. I configured the hosts myself - I'm not strong in this.
Tell me how to tightly cut /public/index.php and get normal indexing of the site.
httacces in root
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule (.*) http://www.site.com/$1 [R=301,L]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<VirtualHost *:80>
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/site.com/public_html
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port t$
# 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 www.example.com
ServerAdmin [email protected]
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/site.com/public_html
SSLEngine on
SSLCertificateFile /etc/ssl/site_com/site_com.crt
SSLCertificateKeyFile /etc/ssl/site_com/site_com.key
SSLCertificateChainFile /etc/ssl/site_com/site_com.ca-bundle
# 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>
<Directory /var/www/site.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question