Rewrite mode doesn't work with virtualhost and symfony4 - apache

I'm using symfony4.3 and the application is hosted under vps ubuntu 18.04.
I have followed https://symfony.com/doc/current/setup/web_server_configuration.html to configure the web server but the problem is that the application doesn't work with rewrite mode, but it works when adding /public/index.
I mean www.mysite.com doesn't work. It show the folders and files but www.mysite.com/public/index.php dispaly the website content.
The domain name is secured with https
This is the configuration:
<VirtualHost *:80>
ServerAdmin webmaster#s****.com
ServerName www.s****.com
ServerAlias s****.com
# For Apache 2.4.9 or higher
# Using SetHandler avoids issues with using ProxyPassMatch in combination
# with mod_rewrite or mod_autoindex
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
# for Unix sockets, Apache 2.4.10 or higher
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
</FilesMatch>
DocumentRoot /var/www/site/public
DirectoryIndex /index.php
<Directory /var/www/site/public>
AllowOverride All
Require all granted
FallbackResource /index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect to URI without front controller to prevent duplicate content
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 307 ^/$ /index.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
</Directory>
# optionally disable the fallback resource for the asset directories
# which will allow Apache to return a 404 error when files are
# not found instead of passing the request to Symfony
<Directory /var/www/site/public/bundles>
FallbackResource disabled
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
<Directory /var/www/site>
Options FollowSymlinks
</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}/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
# optionally set the value of the environment variables used in the application
#SetEnv APP_ENV prod
#SetEnv APP_SECRET <>
#SetEnv DATABASE_URL "mysql://db_user:db_pass#host:3306/db_name"
</VirtualHost>

Solved:
I have another file default-ssl.conf , I must put those configuration inside:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin contact#s****.com
ServerName www.s****.com
ServerAlias s****.com
DocumentRoot /var/www/site/public
<Directory /var/www/site/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Allow from All
Require all granted
<IfModule mod_rewrite.c>
# copy configuration here
</VirtualHost>
</IfModule>

Related

Letsencrypt apache, disable https for specific directory

Im using ubuntu, apache and letsencrypt. I want to disable https for one directory.
This is my .htaccess right now:
RewriteEngine On
RewriteBase /
#HTTP TO HTTPS
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
domain.nl should redirect to https://domain.nl. (As it does now)
http://domain.nl/keuken (or http://domain.nl/keuken/keuken.php is also ok) should just be http.
I can not get it to work.
I tried several solutions from stackoverflow but either it does nothing or i get to many redirects.
I found the answer. The .htaccess in my question has nothing to do with it.
I changed the virtualhost config file: 000-default.conf in /etc/apache2/sites-available to this:
<VirtualHost *:80>
# 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 webmaster#localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
</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}/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
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/keuken(/|$) [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
If i am correct this means everything except /keuken is redirected to https.

Apache failing for MediaWiki

I have made a mistake while editing config files (new kid on the block). But now our Mediawiki is not being displayed anymore correctly. The page will load but it will display akward, and the normal formatting is gone.
The page it self is white and missing all kinds of formatting
Hyperlinks are being displayed in blue, which have not been clicked
Other hyperlinks that have been clicked are being displayed in purple
Titles are being displayed in black color
I assume the error is within 000-default.conf. I tried to find the error and correct it my self but I have come to a point whereby I really require assistance. So I was hoping someone could take a look at the config and find what is faulty.
Server version: Apache/2.4.29 (Ubuntu)
Header always unset "X-Powered-By"
Header always unset "Server"
Header unset Server
ServerSignature Off
ServerTokens Full
#xSecServerSignature Undisclosed
Header set X-XSS-Protection "1; mode=block"
Header set Referrer-Policy "strict-origin"
Header set X-Robots-Tag "noindex"
Header set X-Frame-Options "SAMEORIGIN"
Header set Feature-Policy "fullscreen *"
<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
ServerName wiki.example.com
AllowEncodedSlashes On
Redirect permanent "/" "https://wiki.example.com"
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/mediawiki/"
<Directory "/var/www/mediawiki/">
Options +FollowSymLinks +Includes +ExecCGI
AllowOverride All
RewriteEngine On
RewriteBase /mediawiki/
RewriteRule ^index\.php$ - [S=1]
RewriteRule ^load\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
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
#LogLevel Debug
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>
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassPhraseDialog builtin
#SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost *:443>
ServerName wiki.example.com"
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/mediawiki/"
SSLEngine on
SSLCertificateFile "/var/www/certs/server.pem"
SSLCertificateKeyFile "/var/www/certs/server.key"
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
<Directory "/var/www/mediawiki/">
Options +FollowSymLinks +Includes +ExecCGI +MultiViews
AllowOverride All
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [S=1]
RewriteRule ^load\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Require all granted
</Directory>
<Directory "/var/www/mediawiki/cache">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/images">
Deny from all
</Directory>
# Protect against bug T30235
<IfModule rewrite_module>
RewriteEngine On
RewriteOptions inherit
RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
RewriteRule . - [forbidden]
# Fix for bug T64289
Options +FollowSymLinks
</IfModule>
<Directory "/var/www/mediawiki/includes">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/languages">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/maintenance">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/maintenance/archives">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/serialized">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/tests">
Deny from all
</Directory>
#LogLevel Debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#prevent https rewrite for parsoid server
<VirtualHost localhost:8142>
</VirtualHost>
It seems that RewriteRule . index.php [L] is the culprit. It processes load.php, which loads all CSS and JavaScript, breaking it.
You can press F12 in Firefox, choose "Network" tab and follow one of the load.php links in the list of loaded files. See what happens. Most probably, it gets redirected into wiki pages.

Pretty urls not working laravel 5.2 on a https protocol

Pretty urls was working on when it was on "http" using this tutorial (https://laravel.io/forum/09-15-2015-removing-indexphp-from-url-laravel-5116) i figured it out but as i configured the "https" it stopped working
(Not Found
The requested URL /login was not found on this server.
Apache/2.4.7 (Ubuntu) Server at wasamar.com.ng Port 443), what did i do wrong?
by the way i am using an ubuntu cloud server 14.04
This is my virtual host config /etc/apache2/sites-avalable/wasamar.com.ng.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 wasamar.com.ng
ServerAlias www.wasamar.com.ng
ServerAdmin info#wasamar.com.ng
DocumentRoot /var/www/html/wasamar/public/
# Redirect permanent "/" "https://wasamar.com.ng/"
<Directory /var/www/html/wasamar/public/>
Options Indexes FollowSymLinks
AllowOverride All
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}/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 examplethe
# 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>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin info#wasamar.com.ng
ServerName wasamar.com.ng
DocumentRoot /var/www/html/wasamar/public/
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
<Directory /var/www/html/wasamar/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/apache2/ssl/wasamar.com.ng/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/wasamar.com.ng/apache.key
</VirtualHost>
</IfModule>
This is my .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# 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}]
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I think the https redirect should be first:
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
...

laravel the requested url was not found on this server

I've an Ubuntu 14.04 kernel. I was installing my Laravel application in this server.
After installing, I tried to set the root directory to public.
sudo nano /etc/apache2/sites-available/000-default.conf
I have only these options in the file
<VirtualHost *:80>
# 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 webmaster#localhost
DocumentRoot /var/www/html/public/
# 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>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I've changed the Document root to
DocumentRoot /var/www/html/public/
Now when I tried to access my Laravel App, through 123.xxx.xxx.xxx/ it shows the home page and working well. It gets all the GET variable too. Eg: 123.xxx.xxx.xxx?type=wefwef
But when I go to other links such as 123.xxx.xxx.xxx/login it gives me an error
Not Found
The requested URL /login/ was not found on this server.
Apache/2.4.7 (Ubuntu) Server at 104.236.234.85 Port 80
I have the routes.php working well on localhost. But not on this server. Please help me.
This looks like you have to enable .htaccess by adding this to your vhost:
<Directory /var/www/html/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
If that doesn't work, make sure you have mod_rewrite enabled.
Don't forget to restart apache after making the changes! (service apache2 restart)
I resolved by doing the following:
Check if there is a module called rewrite.load in your apache at:
cd /etc/apache2/mods-enabled/
If it does not exist execute the following excerpt:
sudo a2enmod rewrite
Otherwise, change the Apache configuration file to consolidate use of the "friendly URL".
sudo nano /etc/apache2/apache2.conf
Find the following code inside the editor:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Change to:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
After that restart the Apache server via:
sudo /etc/init.d/apache2 restart
First enable a2enmod rewrite
next restart the apache
/etc/init.d/apache2 restart
click here for answer these question
Alternatively you could replace all the contents in your .htaccess file
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
See the docs here.
https://laravel.com/docs/5.8/installation#web-server-configuration
For Ubunutu 18.04 inside a vagrant box ... This is what helped me
Ensure www-data has permissions to the .htaccess file
sudo chown www-data.www-data .htaccess
edit the apache2 conf to allow for symlinks etc
sudo nano /etc/apache2/apache2.conf
Add this to the file
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
Restart your apache2 server
sudo service apache2 restart
I hope this helps someone.
In addition to all the answers if you still encounter some variation of the problem, edit the .env file and set APP_URL to your domain name as in:
APP_URL=similar_to_my_avatar_link
In httpd.conf file you need to remove #
#LoadModule rewrite_module modules/mod_rewrite.so
after removing # line will look like this:
LoadModule rewrite_module modules/mod_rewrite.so
And Apache restart
too late.. but for the benefit
you can edit your .htaccess file
comment this line
# RewriteRule ^ index.php [L]
Make sure you have mod_rewrite enabled.
restart apache
and clear cookies of your browser for read again at .htaccess
I have faced the same problem in cPanel and I fixed my problem to add in .htaccess file below these line
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Add the following to .htaccess in public folder.
<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]
</IfModule>
In current version of Apache in httpd.conf there are lines:
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
...
</Directory>
instead of earlier here mentioned:
DocumentRoot /var/www/
<Directory /var/www/
...
</Directory>
It depends on your server's directory structure, but by default I guess it can look like this.
As was recommended, inside Directory tag I changed options like this:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
by default it was AllowOverride none. It helped.
And of course LoadModule rewrite_module modules/mod_rewrite.so in the same file should be switched on.

Apache Rewrite rules not working as expected

I have two apache servers both have identical settings, I cloned the apache config files, and changed the ServerName part only. When I type mysite.com/somestuff it should rewrite to index.php it does it on my old server, but not my new. I have made sure the .htaccess is there when I do mysite.com/index.php/somestuff it works, but like my first site I need it to work with mysite.com/somestuff.
I am really banging my head against the wall here is my .htaccess and apache config file
#.htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule .? %{ENV:BASE}index.php/ [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
Now for my apache config
<VirtualHost *:80>
ServerAdmin user#host.com
ServerName mysite.com
DocumentRoot /home/richardw/www/halogen/web
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/richardw/www/halogen/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
My apologizes if this is a repost, but I've been searching all over and i'm about to lose it.
When you go to http://mysite.com/, are you redirected to http://mysite.com/index.php/?
If this is happening, that means mod_rewrite is not loaded in your new server. You need to make sure it's loaded in your apache's server config file. See this answer for some instructions on how that works for apache.
The reason why the redirect is working is because of this container:
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
This essentially says "if mod_rewrite is not loaded", then if mod_alias is loaded, it redirects the root request to /index.php/. So if the redirect is happening, mod_rewrite is not loaded.
Have you try to comment or remove this line
Options +FollowSymlinks
in your .htaccess?