halenharper
@halenharper
Любознательный

Laravel 5 httacces и сервер Ubuntu. Почему сайт индексируется как site.com/public/index.php?

Добрый день.
Установил Laravel 5 по заводской инструкции. Прописал httacces как в мануале. Все стандартно, ничего не обычного. Развернул приложение в продакшн.
Теперь вижу, что сайт проиндексировался как site.com/public/index.php и т.д. Т.е. в url присутствует /public/index.php.
Если зайти по прямой ссылке site.com, то в адресной строке получу site.com/public/index.php и придальнейшем хождении по сайту /public/index.php в строке остается.
Если захожу по прямой ссылке site.com/news и дальше ползаю по сайту - public/index.php в адресе уже нету. Все работает в обоих случаях.
Сайт развернут на своем сервере Ubuntu server 14.04. Настраивал хосты сам - не силен в этом.
Подскажите, как нахлухо вырезать /public/index.php и получить нормальное индексирование сайта.

httacces в корне
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_URI} !^public
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

httacces в public
<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>

etc/apache2/sites-enabled/site.com.conf
<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 vitali@site.com
        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
  • Вопрос задан
  • 287 просмотров
Пригласить эксперта
Ответы на вопрос 2
@AleDv
Решил ли этот вопрос? Я тоже с таким столкнулся
Ответ написан
pLavrenov
@pLavrenov
Разработка сайтов
Укади документрут домена на папку public
DocumentRoot /var/www/site.com/public_html/public
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы