Arindam Barman
Arindam Barman

Reputation: 107

Subdomains using UI-Router

I am using UI-Router in my Angularjs app on Apache. I want to use subdomains for user profiles. How can I change http://example.com/variable to http://variable.example.com and trailing urls. Is there a way this could be done using htaccess?

Upvotes: 1

Views: 821

Answers (1)

Peter Lyons
Peter Lyons

Reputation: 146104

So when a user logs in your server side code should redirect them to their subdomain with an HTTP 302 redirect. Once there, the angular app can load. Note that changing the hostname will cause a full page reload (your angular app will start over), so you could do this for login but you wouldn't want to do this if userA is allowed to visit userB's profile as angularjs is optimized for single page applications and using subdomains like this would make your app a multi-page application.

Upvotes: 1

Related Questions