Skip to main content

htaccess redirect from www to https issue

Comments

4 comments

  • DouglasRedvers
    I have solved it with help of a few others. The below now works as it should. I would like to know if it is possible to remove the RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ references or are they necessary for the ssl RewriteEngine On 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.site.com.au/ [R=301,L] RewriteCond %{HTTPS} !on RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.site.com.au/$1 [R=301,L] 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.site.com.au/$1 [R=301,L]
    0
  • cPanelLauren
    Hi @Douglas Machado I'm glad to hear you were able to solve your issue. Thanks for updating and letting us know and for providing the solution that worked for you.
    0
  • David Colter
    I would like to know if it is possible to remove the RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ references or are they necessary for the ssl

    @cPanelLauren Is there an answer to this question? Is this addressed in another thread?
    0
  • cPanelLauren
    Hello @David Colter This is added to the .htaccess file when something prevents the DCV check from completing successfully. It's necessary for AutoSSL to function and while you can remove it, it will be readded during the next AutoSSL run. This is an exception rule that only allows the cpaneldcv check to successfully complete and should not interfere with anything else.
    0

Please sign in to leave a comment.