I have two websites on a Red Hat Linux server; the first one is located in var/www
and has the below configuration on var/www/html/.htaccess
.
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# Reroute to index.php
RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>
The second site is located in var/www/laravel
, and its config file is in var/www/laravel/public/.htaccess
. I have tried using the same config as the first site, deleting the file, and using default config listed below:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I have also used the config provided in the documentation:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I have also checked if my mod_rewrite
is uncommented with this command:
grep -i LoadModule /etc/httpd/conf/httpd.conf | grep rewrite
and it is.
The first website works fine without index.php
, but the Laravel one needs it.
Any hints on what I'm doing wrong?
EDIT: thats how I created the alias for the second website maybe it helps:
<VirtualHost *:80>
ServerAdmin example@example.com
DocumentRoot /var/www/html/
ServerName www.example.com
ServerAlias *.example.com
Alias /laravel /var/www/laravel/public/
ErrorLog "|/usr/sbin/rotatelogs /var/log/httpd/www.example.com-error_log.%y%m%d 86400"
CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/www.example.com-access_log.%y%m%d 86400" combined
# php_admin_value upload_tmp_dir "/var/www/html/tmp/"
# php_admin_value open_basedir "/var/www/html/:/var/cache/www/"
<Directory /var/www/html/>
AllowOverride All
</Directory>
<Directory /var/www/laravel/public/>
AllowOverride All
</Directory>
</VirtualHost>