In our drupal 7 site we were not providing user registration and redirect the the user/register page to the base url using .htaccess.
#Custom redirects
RewriteRule ^user/register$ http://%{HTTP_HOST} [R=301,L]
#End Custom redirects
It is working and now I need to redirect ‘?q=user/register’ also to that base url. When I tried with
RewriteRule ^?q=user/register$ http://%{HTTP_HOST} [R=301,L]
but it was not working.
The URI
/?q=user/registeris already the base, it’s just got a query string, the URI is still/. If your goal is to remove the query string, then you need to match against the query string first, which you can’t do in aRewriteRule. You need to match against%{QUERY_STRING}in aRewriteCond:Note that the target has a
?at the end, this will remove the query strring so q=user/register won’t get automatically appended.