0

I currently have a website (ab.example.com), where 'example.com' is the company's root domain. and 'ab' is a product's subdomain(website). Within the website (ab.example.com), I have multiple sub-products (gala, granny smith, fuji).

When a customer goes to ab.example.com/apples/gala I want them to be redirected as gala.example.com/apples. Similarly for any other sub-products I have. I understand that this is similar to .htaccess redirect to subdomain based on query string parameter, where .htaccess at the root folder is being used to add the redirect rules.

But does this mean that no changes have to be made in the cpanel or update dns entries for the new subdomains? I have also looked into the wildcard domain methood - Create subdomains on the fly with .htaccess (PHP).

I am confused about which method to use. I'm fairly new to php and its frameworks. The web application is in ,

  • php
  • Laravel
  • Azure
  • Apache
  • Linux(Ubuntu)
user3344978
  • 644
  • 1
  • 8
  • 22
  • Hi! Unfortunately, this is a REALLY broad question. Depending on your setup this could be done at many levels, and in many ways. I would recommend doing some more reading/researching then coming back to Stackoverflow if you have a specific question that you cannot find an answer to elsewhere on the site! Good luck! – Josh May 23 '19 at 18:23
  • @Josh Would you be able to tell me what sort of setup so I can do a more focused research ? – user3344978 May 23 '19 at 18:28
  • Well, break down your problem. You've found the link above for creating subdomains using .htaccess. Have you tried following that, can you now access your app via any subdomain? If so, then it looks like the next step is taking a path and redirecting it to the subdomain you want, try doing this in Laravel! A great resource for all things Laravel is the official docs: https://laravel.com/docs/5.8/installation – Josh May 23 '19 at 18:34

0 Answers0