We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

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

  • 3 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)/(.*)$ http://example.co.uk/$1/$2  
  ProxyPassMatch ^/(.*)$ http://example.co.uk/archive/$1
  ProxyPassReverse / http://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