I have 2 sets of rewrite rules. This is a virtual host:
<VirtualHost *:80> ServerName datingjapan.co ServerAlias *.datingjapan.co RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*) http://www.%{HTTP_HOST}$1 [R=301,L] DocumentRoot /var/www/html/datingjapan.co </VirtualHost>
and this .htacess
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>
I am trying to add .htaccess to a virtual host so that I can delete the .htaccess file - below is an example, but I get a site to show:
<VirtualHost *:80> ServerName datingjapan.co ServerAlias *.datingjapan.co RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php?/$1 RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*) http://www.%{HTTP_HOST}$1 [R=301,L] DocumentRoot /var/www/html/datingjapan.co </VirtualHost>
I understand that [L] means the last rule matches, so I deleted it, but it still does not work.
What am I missing here? I tried to change the rules.
Thankyou
source share