Redirect subdomain (HTTP & HTTPS) to another URL
10 posts
• Page 1 of 1
Redirect subdomain (HTTP & HTTPS) to another URL
Hi
I'm hoping someone can help me. I need to redirect a subdomain that uses both HTTP and HTTPS to a URL on another site.
So, for example :
I need http://subdomain.domain.com and https://subdomain.domain.com redirecting to http://www.anotherdomain.com/dir1/dir2/index.asp.
This would be a permanent redirect so a 301 I believe?
Any help would be much appreciated.
Thanks
I'm hoping someone can help me. I need to redirect a subdomain that uses both HTTP and HTTPS to a URL on another site.
So, for example :
I need http://subdomain.domain.com and https://subdomain.domain.com redirecting to http://www.anotherdomain.com/dir1/dir2/index.asp.
This would be a permanent redirect so a 301 I believe?
Any help would be much appreciated.
Thanks
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Hello,
Try using the following:
Regards
Andrew
Try using the following:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:Host} ^subdomain\.domain\.com$ [NC]
RewriuteRule ^$ http://www.anotherdomain.com/dir1/dir2/index.asp [NC,R=301,L]
Regards
Andrew
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Hi Andrew
Thanks for the reply. I've tried the code you suggested but it doesn't seem to work.
I've got the following code to force HTTPS :
Would this affect the code you sent me?
Thanks
Thanks for the reply. I've tried the code you suggested but it doesn't seem to work.
I've got the following code to force HTTPS :
- Code: Select all
RewriteCond %{HTTPS} ^(?!on).*$
RewriteCond %{HTTP:Host} (.*)
RewriteRule (.*) https\://%1$1 [NC,R=301]
Would this affect the code you sent me?
Thanks
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Could be. Lets take at the rewrite.log for the testing request.
Logging issues described in FAQ
Regards
Andrew
Logging issues described in FAQ
Regards
Andrew
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Hi Andrew
I was getting an error which I fixed (spelling mistake in the code) and now I'm not getting any errors in the log file but the redirect still isn't working. The log file now just says ".htaccess - Loaded successfully".
Thanks
I was getting an error which I fixed (spelling mistake in the code) and now I'm not getting any errors in the log file but the redirect still isn't working. The log file now just says ".htaccess - Loaded successfully".
Thanks
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect subdomain (HTTP & HTTPS) to another URL
That's error.log. What does rewrite.log say?
Regards
Andrew
Regards
Andrew
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Ah, OK. I found rewrite.log but don't really want to post it on a public forum. Can I PM it to you?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect subdomain (HTTP & HTTPS) to another URL
a) you may use helpdesk and make a refer to this ticket.
b) only registered users will see the attached log + i can delete it as soon as I see the problem.
Regards
Andrew
b) only registered users will see the attached log + i can delete it as soon as I see the problem.
Regards
Andrew
Re: Redirect subdomain (HTTP & HTTPS) to another URL
Thanks Andrew, I have used the helpdesk for this.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect subdomain (HTTP & HTTPS) to another URL
You must have told it is uses Compatability 2. Even though there wasn't any request to the root of the sub-domain, I suggest uding:
Regards
Andrew
- Code: Select all
RewriteCond %{HTTP:Host} ^subdomain\.domain\.com$ [NC]
RewriuteRule ^/$ http://www.anotherdomain.com/dir1/dir2/index.asp [NC,R=301,L]
Regards
Andrew
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests