Issue
I have a lot of websites on my web server.
I just want to redirect all my websites when the url is exactly /?
www.example1.com/?
www.example2.com/?
but not like www.example.com/x.php?
, www.example.com/
or anything else.
I've tried many things but failed:
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^ %{REQUEST_URI}?_test [L,R=302]
RewriteCond %{QUERY_STRING} ^\?$
RewriteRule ^ http://www.example.com [L,R=301]
RewriteCond %{REQUEST_URI} =="/?"
RewriteRule ^(.*)$ http://www.example.com/ [L,R=301]
Solution
You can use following codes for do that.
RewriteEngine On
RewriteRule ^\?$ http://www.example.com/ [L,R=301]
You define the rule as starts with ? and ends with that sign.
Answered By - Huseyin Answer Checked By - David Marino (WPSolving Volunteer)