如果找到cookie,则使用.htaccess重定向

I want to use .htaccess to redirect users if a cookie is present.

The redirect needs to be on either the domain (e.g. domain.com) or domain.com/index.php and not any other pages and they get redirected to /index.php?option=com_mcloud&view=dashboard

I've tried the following but it's not working:

RewriteEngine On
RewriteCond %{HTTP_COOKIE} joomla_user_state=logged_in; [NC]
RewriteRule %{REQUEST_URI} /index.php?option=com_mcloud&view=dashboard [NC,L]

REQUEST_URI variable only contains uri (/ or /index.php) part of the url not queryString. Try :

RewriteEngine on

RewriteCond %{HTTP_COOKIE} joomla_user_state=logged_in [NC]
RewriteCond %{REQUEST_URI} ^(/|/index.php)$ [NC]
RewriteRule ^ /index.php?option=com_mcloud&view=dashboard [L]