I am trying to do two 301 redirects in my .htaccess: 1. members.mydomain.com/* to https://members.mydomain.com/*
2. members.mydomain.com/topic/yada?subject=1 to https://members.mydomain.com/topic
please help
I am trying to do two 301 redirects in my .htaccess: 1. members.mydomain.com/* to https://members.mydomain.com/*
2. members.mydomain.com/topic/yada?subject=1 to https://members.mydomain.com/topic
please help
You can use the code in your Root/.htaccess :
RewriteEngine on
#Redirect "member.mydomain.com" to https
RewriteCond %{HTTP_HOST} ^members.mydomain.com$
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]
#Remove /yada?subject=1
RewriteCond %{THE_REQUEST} /topic/yada/\?subject=1 [NC]
RewriteRule ^ /topic/? [NC,L,R]
I used R "Temp redirect" for testing purpose and to avoid browser cache. Change R to R=301 when you are sure the code is working fine.