Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Redirect multiple subdomains to different specific index.php files

i'm hosting different sites using the same domain. I would like to redirect each subdomain to different "index.php" Here is an example from what i want to do:

subdomain1.mydomain.com --> http://subdomain1.mydomain.com/subdomain1/index.php
subdomain2.mydomain.com --> http://subdomain2.mydomain.com/subdomain1/index.php

This is my file structure:

/var/www/
    '-- html
        |-- site1
            '-- index.php
        '-- site2
            '-- index.php

I've been trying to achiev this by using the ".htaccess" file, but i'm not getting there.

I know .htaccess isn't the only workaround. I may use javascrip or PHP script

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

you can use this code:

site1-->index.php code:

<?php
header('Location: http://subdomain2.mydomain.com/subdomain1/index.php');
?>

site2-->index.php code:

<?php
header('Location: http://subdomain1.mydomain.com/subdomain1/index.php');
?>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!