Hi there,
I have the below code in my htaccess to direct to https.
Recently I have needed to add more code to make sure my site redirects from index.php to just the domain as otherwise I get a duplicate page at mysite.com.au and mysite.com.au/index.php
I have been trying to find an efficient method of doing this as well as 301 redirecting to https.
The code posted below redirects the index fine and also non-www but if http is inputted it does not go to https. Can anyone see what is wrong
I have the below code in my htaccess to direct to https.
Recently I have needed to add more code to make sure my site redirects from index.php to just the domain as otherwise I get a duplicate page at mysite.com.au and mysite.com.au/index.php
I have been trying to find an efficient method of doing this as well as 301 redirecting to https.
The code posted below redirects the index fine and also non-www but if http is inputted it does not go to https. Can anyone see what is wrong
Code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ https://www.domain.com.au/ [R=301,L]
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://www.domain.com.au/$1 [R=301,L]
Last edited by a moderator: