.htaccess -> Domain parameter -> https://example.com/page is working and https://example.com/ not

Viewed 60

I have a problem with my .htaccess file. I will add any time a parameter with the current domain. It does working for https://example.com/page but not for https://example.com/

My current .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?domain=%{HTTP_HOST}&page=$1 [L,QSA]

I've already tried with .* and . in the RewriteRule instead of ^(.*)$

1 Answers

With your shown samples, simply adding condition for checking of your Uri and then serving it with index.php. Could you please try following. Please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?domain=%{HTTP_HOST}&page=$1 [L,QSA]

RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^ /index.php?domain=%{HTTP_HOST} [L]
Related