Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-02-27 07:18:08
- dazonic
- Member
- Registered: 2006-10-24
- Posts: 43
Site URL on a local server behind a router
Hi,
I’m running Apache, developing locally and i’m behind a DSL router. I have port forwarding set up so i can show a client their site by sending them to http://myip/
My problem is that every time I want to show them their site during testing, I need to change Textpattern’s Site URL from localhost to myip, and I can’t leave it as myip because, when accessed locally, myip sends me to my DSL config.
What can I set my Site URL to that will work locally as well as externally? Any ideas?
Offline
Re: Site URL on a local server behind a router
You can do this:
- Sign up for an account at DynDNS
- Let’s say you pick dazonic.blogdns.com, assign it your external ip, the myip one
- Then modify this line in your hosts file – 127.0.0.1 localhost dazonic.blogdns.com (the location of your hosts file is different on every operating system, just google for the answer)
- Modify your Textpattern’s Site URL to dazonic.blogdns.com
That’s it, you’ve become your own hosting company :)
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
#3 2007-02-27 08:06:11
- dazonic
- Member
- Registered: 2006-10-24
- Posts: 43
Re: Site URL on a local server behind a router
Yes!!! I’ve been mucking around with different ports, virtual hosts, No-IP port 80 redirects, you name it! Thanks heaps :)
Okay what about accessing it from my local network now? I’m running Apache and developing on my Mac and I have a notebook with XP for IE testing.
Offline
Re: Site URL on a local server behind a router
dazonic wrote:
Okay what about accessing it from my local network now?
On your XP machine, c:\windows\systems32\drivers\etc\hosts:
192.168.1.63 dazonic.blogdns.com
Or whatever internal static IP you’ve assigned to your Mac, if it’s not static then you should assign static IP’s to each of the machines, easier for local testing.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: Site URL on a local server behind a router
…also i recommend to make use of the <txp:site_url /> tag. makes life easier when transferring to a remote host etc :)
Last edited by sthmtc (2007-02-27 16:07:33)
Offline
#6 2007-02-27 20:49:30
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Site URL on a local server behind a router
My problem is that every time I want to show them their site during testing, I need to change Textpattern’s Site URL from localhost to myip, and I can’t leave it as myip because, when accessed locally, myip sends me to my DSL config.
Leave your Site URL setting blank. Textpattern will dynamically set it at run-time to the current base URL.
Alex
Offline
#7 2007-02-28 01:41:02
- dazonic
- Member
- Registered: 2006-10-24
- Posts: 43
Re: Site URL on a local server behind a router
hcgtv wrote:
On your XP machine, c:\windows\systems32\drivers\etc\hosts:
192.168.1.63 dazonic.blogdns.com
Perfect. Nothing short of it. Thanks heaps.
zem wrote
Leave your Site URL setting blank. Textpattern will dynamically set it at run-time to the current base URL.
This is also good, but I was having troubles with the address changing itself from http://myip/~username (or http://my.dynamic.dns/~username) to http://my-local-hostname.local/~username when trailing slashes were omitted, thus had to set Apache’s ServerName to “something that would work across the board”.
It’s been solving one problem to cause another up until now, everything’s shmick as :)
Offline