I know this is repetitively asked question but the thing is I can't even find the answer. Recently, we've decided to have https so we want to redirect everything. Upon checking on to the other domains, I saw that http://domain.com/accommodation/ redirects to https://domain.com/index.php. Can you please tell me what is something wrong with my codes?
For the root directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sample/public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
#IP Canonicalization Test with sample IP
RewriteCond %{HTTP_HOST} ^222\.222\.22\.222
RewriteRule (.*) https://domain.com/$1 [R=301,L]
#URL Canonicalization Test
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule (.*) https://domain.com/$1 [R=301,L]
For the public directory:
<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}]
</IfModule>
#IP Canonicalization Test with sample IP
RewriteCond %{HTTP_HOST} ^222\.222\.22\.222
RewriteRule (.*) https://domain.com/$1 [R=301,L]
#URL Canonicalization Test
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule (.*) https://domain.com/$1 [R=301,L]
#Added this for assurance for redirection
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
Thank you for helping me out.
Peace!