• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 redirect one domain

Tracy Perry

Well-known member
#2
i got
but it rederects both of my domains y only what to rederect one of them how would it be
What exactly are you trying to do. Been a long time since I messed with .htaccess, but I believe all THAT one does is rewrite any inbound requests from HTTP to HTTPS.
So, if you request http:// yourdomain.com it goes to https:// yourdomain.com and if you request http:// www.yourdomain.com it goes to https:// www.domain.com.
It does NOT redirect non-www to www (or vice versa).
Is that what you are trying to do?
 
#3
well that rule makes http to https , but i got 2 domains in the same hosting account and that rule makes both https and i what to make one https

sorry i did't new how to call it
 

Tracy Perry

Well-known member
#4
Are both being served by the same root location (which they must be if one .htaccess is effecting them both).

You need to give a little more detail on how it's structured. You place the appropriate .htaccess in each root location.

If they are both being served out of the same root location then you only need to do the https rewrite for that one domain, not a global one like you have done.
Do both domains point at the same site? If so, why are you doing it like that. Just redirect the one domain to the https one.
 

Jake Bunce

XenForo moderator
Staff member
#5
This will allow you to specify the domain name you want to be https:

Code:
RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} yoursite\.com$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 

Jake Bunce

XenForo moderator
Staff member
#8
@Jake Bunce
How to do it
ex.mydomain.com redirect
mydomain.com/forums/ex or mydomain.com/category/ex or mydomain/com/widget-pages

Thanks Jake Bunce
Add this code to the top of the .htaccess file at ex.mydomain.com

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^ex\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex/$1 [L,R=301]
 

time

Active member
#9
Add this code to the top of the .htaccess file at ex.mydomain.com

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^ex\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex/$1 [L,R=301]
I can do it with the code below
Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^ex\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^ex2\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex2/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^ex3\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex3/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^ex4\.mydomain\.com$
RewriteRule ^(.*)$ http://mydomain.com/forums/ex4/$1 [L,R=301]
Thanks @Jake Bunce