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

235
Views
How to redirect through htaccess without changing the URL?

I am currently using the code below to point all subdomains to their document root.

RewriteCond %{HTTP_HOST} ^(.*)\.example\.co [NC]
RewriteRule ^(.*)/?$ http://example.co/%1/$1 [P]

subdomain.example.co will point to example.co/subdomain but the URL will remain untouched.

The problem with this is that when you try to retrieve the URL, through PHP, it will always return example.co/subdomain despite the fact that the URL bar displays it as a subdomain. I believe this is due to the Proxy flag.

How could I achieve the same effect but allow for the actual URL that the user is on (the subdomain) to be retrieved?

Overall

  • allsubdomains.example.co should point to example.co/allsubdomains

  • The URL should remain as allsubdomains.example.co

  • When retrieving the current URL through PHP, it should return allsubdomains.example.co

over 4 years ago · Santiago Trujillo
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!