when i try to access control panel www.domain.com/cp it takes me to www.domain.com/index.php

# -----------------------------------------------------------------------
# REDIRECT WWW VERSION TO NON-WWW OR VICE VERSA
# -----------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]

Can anyone help me why this redirect is happening

Answered by Andreas Kviby! Go to answer.