mercredi 9 mars 2016

Rewrite mode for Laravel 5 on LAMP

I've just finished my laravel 5 app and it works fine on homestead, now I pushed it to production and I found that the routing system isn't working except for "/" so here is my configurations for .htaccess and LAMP also I'm using let's encrypt too.

this is my .htaccess:

<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]

and this is my /etc/apache2/sites-available/mohamed-cherif.ml.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 www.example.com

ServerAdmin mohamed_che@hotmail.fr
ServerName mohamed-cherif.ml
ServerAlias http://ift.tt/1M7tAJQ
DocumentRoot /var/www/ceevee/public
<Directory /var/www/ceevee/public>
    # Don't show directory index
    Options -Indexes +FollowSymLinks +MultiViews

    # Allow .htaccess files
    AllowOverride All

    # Allow web access to this directory
    Require all granted
    </Directory>
# 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}/mohamed-cherif.ml.error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/mohamed-cherif.ml.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
RewriteEngine on
RewriteCond %{SERVER_NAME} =mohamed-cherif.ml [OR]
RewriteCond %{SERVER_NAME} =http://ift.tt/1M7tAJQ
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

and finaly when I use sudo a2enmod rewrite it says Module rewrite already enabled

please help, regards.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire