Forum

Thread tagged as: Question, Configuration, Runway

Subdomains in Runway

Hi

I want to create a subdomain for a member's area on this Runway site I'm building. The reason for this is so I can limit access to certain videos stored on Vimeo / Youtube by limiting access from a subdomain only. It's a broadcaster site so some of the videos are private.

How do I get Perch to map a subdomain address to a routed page in Runway?

For example.

Members page is example.com/private.

I want this page to appear as private.example.com/ not forward to the address.

Is this possible? I realise this is out of the remit of Perch but again would appreciate any pointers. I've seen a couple of threads discuss this but no solution's been shared as far as I can see. I'm guessing it's htaccess-related rather than internal routes in Perch.

Many thanks in advance,

Jon

Jonathan Elliman

Jonathan Elliman 27 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you might just be able to tell Perch which page you're using:

PerchSystem::set_page('/private');
Duncan Revell

Duncan Revell 78 points
Registered Developer

I've previously spent some time trying to find answers to the same. I eventually found this as something that worked for me - but I used the Apache conf files. I think you can do similar in htaccess, but you have to use the [P] flag. I can't remember, but you must need to have mod_proxy enabled too.

<VirtualHost *:80>
  ServerName archive.example.co.uk
  ProxyRequests Off
  ProxyPassMatch ^/(css|img|js)/(.*)$ https://example.co.uk/$1/$2  
  ProxyPassMatch ^/(.*)$ https://example.co.uk/archive/$1
  ProxyPassReverse / https://example.co.uk/archive
</VirtualHost>

You don't have to have ProxyRequests Off in there (it's the default), but for safety, include it. The first ProxyPassMatch passes resource requests to the right place (css, images and js folders), otherwise the second ProxyPassMatch redirects everything to the archive 'page'.

The example.co.uk/archive is still accessible in its own right, so possibly call it something a bit more obscure if you don't want people guessing it exists.

This is only helpful if you have access to the Apache conf files...

Thanks for the advice chaps. The client's on a particularly stinky shared hosting package I can't prise them off so I might have to abandon this idea for now.

Kind regards

Jon