0

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

troy
  • 29
  • 1
  • 7
  • Possible duplicate of [Generic htaccess redirect www to non-www](http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www) – Alexis Tyler Jan 30 '16 at 23:44

1 Answers1

0

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.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
  • Hi, thanks for answering, I added the code to .htaccess after # END WordPress but with no change. :( – troy Jan 31 '16 at 19:42