Help With an HtAccess Issue

Help With an HtAccess Issue

This is not directly WordPress related. Only really an htaccess question, yet it is quite important to our business.

If inappropriate to ask here, I will completely understand.

The issue though is that I am needing to create an htaccess url rewrite to redirect users in the following manner.

1. Visitor goes to “technobrains.timeclockboss.com”.

2. They need to be redirected to “https://accounts.timeclockboss.com/login/?Subdomain=technobrains”

This is so our SaaS can function as intended.

It is my hope there is an htaccess expert here who might just know how to make this magically happen. =)

Anyway, thank you for listening to me guys.

  • Adam Czajczyk
    • Support Gorilla

    Hello Devi,

    I hope you’re well today and thank you for your question!

    I understand that you need to redirect all traffic from the “technobrains.timeclockboss.com” sub-domain to that given URL, is that correct?

    You may do this by placing a .htaccess file in the folder of that sub-domain, putting this code inside:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) https://accounts.timeclockboss.com/login/?Subdomain=technobrains [R=301,L]

    I hope that helps!

    Best regards,

    Adam

  • Devi
    • Design Lord, Child of Thor

    Actually I wasn’t very clear in my original post. My bad there.

    It is more like the subdomains are businesses that are clients of ours. Meant to be an easy way for them to remember how to access our SaaS.

    So it could be

    business5.timeclockboss.com

    company2.timeclockboss.com

    And they would both have to be redirected to “/login/?Subdomain=technobrains”.

    I was actually getting him from a fellow named Vaughan in a different post on the same subject. (I made a mistake when I created the original one, and couldn’t change the title of the post OR figure out how to delete it. :slight_frown: Kind of fumbled around there a bit.

    The original post: https://premium.wpmudev.org/forums/topic/this-is-not?replies=8#post-1140955

    But he suggested I use the following code:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(.+).timeclockboss.com$ [NC]
    RewriteCond %{HTTP_HOST} !^accounts.timeclockboss.com$ [NC]
    RewriteRule ^ https://accounts.timeclockboss.com/login/?Subdomain=technobrains [L,R]

    Which actually did the trick! It worked fine on timeclockboss.com. However, I had to do this on 2 completely different domains for the EXACT same issue / SaaS. And on those two servers I am getting “Server Not Found” errors when I try to do something like go to technobrains.OTHERDOMAIN.com.

    And I have no idea why.

    The DNS records are almost exactly the same..

  • Milan
    • WordPress Wizard

    Hello Devi ,

    Hope you are well today and won’t mind me chiming here. :slight_smile:

    Thank you for informing about duplicate threads created by you for this same issue. I can see that Vaughan is helping you there very well. So I am closing this thread and linking it to your original thread ( it will help us to help you better way and organise things here )

    Please follow up there.

    Best Regards,

    Milan

    [ Linked To: https://premium.wpmudev.org/forums/topic/this-is-not]

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.