Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Creating sub-domain URIs. How?
Can someone explain how (or what is needed) to make this…
domain.tld/sub
Into a working URL like this…
sub.domain.tld
I.e., I could post that second link anywhere online as a URI, people could follow it, and see that same URL structure in their browser.
I’m guessing this involves zone file changes, but I’ve never been able to figure it out. Can someone clear the smog once and for all?
Offline
Re: Creating sub-domain URIs. How?
That first question is independent of Txp.
But now let’s introduce that factor into the equation. What if we’re not talking about separate sub-directories (where you could install separate systems/projects), but simply sub-folders in a Txp install location… Could you still create such URIs like that?
E.g. if you had….
txpinstall.tld/sub
Could it be forced as…
sub.txpinstall.tld
?
I’m thinking this is where it gets impossible, right?
Offline
Re: Creating sub-domain URIs. How?
I remember there was an htaccess rule. Somebody correct me please.
RewriteEngine on
RewriteBase /
RewriteRule ^/sub/(.*)$ http://sub.domain.tld/$1 [R=301,L]
and here is another one I found on the net
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteRule ^/?market/(.*)$ http://market.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteRule ^/?buddies/(.*)$ http://buddies.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteRule ^/?bazaar/(.*)$ http://bazaar.example.com/$1 [L,R=301]
Last edited by colak (2016-03-02 15:05:12)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Creating sub-domain URIs. How?
So it doesn’t involve zone files and DNS mapping magic?! I’ve been led astray.
Offline
#5 2016-03-02 16:31:50
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 553
Re: Creating sub-domain URIs. How?
Destry wrote #298119:
So it doesn’t involve zone files and DNS mapping magic?! I’ve been led astray.
That’s the way I usually go about it myself. I make all the changes in the control panel for my domain name.
I guess there’s more than one way to go about creating sub-domain URLs
Offline
Re: Creating sub-domain URIs. How?
Algaris, I think for my first situation at top it’s probably better to do it at the zone file level like you do, because there may not always be an .htaccess file involved.
Could you provide a little extract/dummy example of zone records showing how you do that? Or have a good link that demos it somewhere? Doesn’t it require having multiple IP addresses or something?
Offline
Re: Creating sub-domain URIs. How?
Never mind. Don’t trouble yourself. I think we’ve got it figured out when the time comes.
Offline