0

Yes , My Question was duplicate which exist already , But was not working through the following way that's why i asked it .

My .htaccess file like below , But not working

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$

RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Please guide me , Thanks in advance.

vjy tiwari
  • 843
  • 1
  • 5
  • 17

1 Answers1

0

Your first problem is that the redirect rule ([L,R=301]) needs to be before your routing rules. Try simply re-arranging the order:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220