Skip to content

Instantly share code, notes, and snippets.

@cpereiraweb
Created September 20, 2016 22:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpereiraweb/ed7706d7397a1200880f70af0515d861 to your computer and use it in GitHub Desktop.
Save cpereiraweb/ed7706d7397a1200880f70af0515d861 to your computer and use it in GitHub Desktop.
Laravel rodando em alias (url subdir) no Apache 2.4
#1) crie os alias para o subdir
Alias /crm/ /srv/www/portais/crm/public/
Alias /crm /srv/www/portais/crm/public/
#2) defina as permissões do diretório físico
<Directory "/srv/www/portais/crm/public/">
AllowOverride All
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
Require all granted
</Directory>
#3) defina as configurações do Location
<Location /crm>
RewriteEngine On
RewriteBase "/crm/"
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</Location>
<Location /crm/>
RewriteEngine On
RewriteBase "/crm/"
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</Location>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment