WebFaction
Community site: login faq

Hi,

I have website setup (Static, PHP 5.5, Apache). Website's main domain is testuj.org.pl. On this website i have directory structure of a kind:

  • client1
    • site1
    • site2
  • client2
    • site1
    • site2

etc.

is it possible to set up Apache (or something) to have dynamic subdomains like:

site1.client1.testuj.org.pl

site2.client1.testuj.org.pl

site1.client2.testuj.org.pl

site2.client2.testuj.org.pl

etc.

OR

site1-client1.testuj.org.pl

site2-client1.testuj.org.pl

site1-client2.testuj.org.pl

site2-client2.testuj.org.pl

etc.

i saw (and was working) on this kind of config, but it was on custom VPS - it was very useful (for example the webroot was always /, and not /client1/site1 etc), plus it's nicely readable by the end-user.

please let me know if this is possible on WebFaction?

cheers

asked 05 Feb '15, 13:35

neohades
13
accept rate: 0%

edited 05 Feb '15, 13:37


Sure, you should be able to do that with mod_rewrite rules in .htaccess at the root of the app directory.

I think something like this might work:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+)\.(.+)\.testuj\.org\.pl [NC]
RewriteRule ^(.*)$ /%2/%1/$1 [P,L]

If that doesn't work, then if you can give us an example of the rewrite rules that you used on your old VPS, then we can see if there's a way to make them work here.

Hope that helps!

permanent link

answered 05 Feb '15, 20:20

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×224
×128
×75
×4

question asked: 05 Feb '15, 13:35

question was seen: 1,073 times

last updated: 05 Feb '15, 20:20

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM