I am trying to use the .htaccess file to remove the index.php from the domain. I have the following in the file and it works fine.
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]However I am also trying to forward anyone who reaches the site at https://domain.com to forward them to https://www.domain.com. I have the following in place, but I am having some issues with it.
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteCond %{HTTP_HOST} (.+)$ [NC]
RewriteRule ^(.*)$ <a href="http://www.%1/$1">http://www.%1/$1</a> [R=301,L]
</IfModule>For the most part it is working. The only issue is when navigating to a sub page the index.php gets added. Example navigating to https://domain.com/sub sends you to https://www.domain.com/index.php?/sub.
The page still works fine, only now it’s even uglier. I am not super familiar with the Rewrite stuff so any help would be appreciated. I am using the HTML5 Boilerplate if anyone is familiar with that.
thanks