1. 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

Discussion in 'Troubleshooting and Problems' started by fernando1027, Dec 27, 2014.

  1. fernando1027

    fernando1027 Member

    i got
    but it rederects both of my domains y only what to rederect one of them how would it be
     
  2. Tracy Perry

    Tracy Perry Well-Known Member

    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. fernando1027

    fernando1027 Member

    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
     
  4. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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]
    
     
  6. fernando1027

    fernando1027 Member

    thanks both i fix it :)
     
  7. time

    time Active Member

    @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
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  9. time

    time Active Member

    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
     

Share This Page