Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Site URL

#1 2007-03-06 10:20:16

n0va
New Member
Registered: 2007-03-06
Posts: 4

Site URL

What should I set for siteurl variable?
I am trying to set up a Textpattern installation on my home comp, which connects to the internet through a router.
It seems that from this computer, if I try to access the server through the external IP (port 80 is portforwarded to my comp), it doesn’t respond. I cannot access any port on my comp from my external IP, however, on another computer, I can.
If I set siteurl to localhost or my local IP, anybody who accesses the site through my external IP will be forwarded to localhost or local IP on their network instead. But if I set siteurl to my external IP, I would be redirected to my external IP if I use localhost or my local IP and thus not able to access the site.

So, can I set siteurl to something to prevent this headache or am I stuck with changing the siteurl to localhost or use a proxy everytime I need to view the site?

Offline

#2 2007-03-06 10:33:44

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Site URL

Leave it blank.


Alex

Offline

#3 2007-03-06 10:54:58

n0va
New Member
Registered: 2007-03-06
Posts: 4

Re: Site URL

This may sound weird, but when I leave it blank, the stylings of the vanilla installation page disappears.
If I use forward slash (/) it redirects to http://textpattern/

Last edited by n0va (2007-03-06 10:55:43)

Offline

#4 2007-03-06 21:39:30

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Site URL

You really shouldn’t be trying to serve a live site through your own computer, that’s just begging for trouble.

Offline

#5 2007-03-07 07:26:48

n0va
New Member
Registered: 2007-03-06
Posts: 4

Re: Site URL

Well, I’m still a student (no cash). And mainly, I’m experimenting with blogging platforms to suit my needs, if I ever do set up a site later.

I’ve tried b2evo, wordpress and drupal and several others, but they are usually either too complicated (in the sense that there are too many weird things I have to set up before I do certain stuff) or too simple to allow me to achieve my needs. Heck, I’ve even tried programming one my own in PHP. It actually works, until I decided to make it do more than a simple blog and make it extensible and so many different feature requests from myself that I didn’t know where to start off, and gave up.

Thus I ended up with Textpattern. The only problem I have now is the siteurl variable.

Besides, I have a dynamic IP, and nobody can reach me if I power my comp (which is pretty frequent). Bring trouble on! I’m not afraid ;P

Offline

#6 2007-03-07 14:31:10

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Site URL

This came up on this thread: Site URL on a local server behind a router

I hosted my own sites for the longest time, it was when I was experimenting with web apps and couldn’t decide which one to use. They were hosted on an old computer running Linux, I paid like $50 for it from a Government surplus store, it still runs today, it’s call Pentpro.

Wish I had the bandwidth to spare, I’d go back to hosting my sites locally. My upload speed tops out at 491 kbps, and if I get a lot of traffic, my surfing suffers and the local network inhabitants start an uprising.

Keep on experimenting :)

Offline

#7 2007-03-08 09:35:22

n0va
New Member
Registered: 2007-03-06
Posts: 4

Re: Site URL

@hcgtv: the problem with the solution in the thread you brought up was that I could not access my own port 80 from an external ip. So modifying the hosts file would have no effect.

I finally solved the problem. I set the siteurl to empty, and changed a line in textpattern/index.php and textpattern/publish.php
I think that’s where the code appears.

$prefs['siteurl'] = $siteurl = $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');

It appears that when Textpattern is in the root of the webserver with a blank siteurl, and access it with http://myip/ or whatever, dirname returns a backslash (making the siteurl become http://localhost\) instead of a forward slash, and rtrim only removes forward slashes from the end.

Why this happens I have no idea (probably PHP decided to follow the operating system slash format), and upon changing it to $prefs['siteurl'] = $siteurl = $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/'); meaning I trim both the forward and back slash characters instead of just the forward slash from the end of the dirname call.

I’ve confirmed that it doesn’t happen if you don’t have the base textpattern script (index.php) at the root of the server, like in http://ip/foo/.

Offline

  1. Index
  2. » Archives
  3. » Site URL

Board footer

Powered by FluxBB