views:

37

answers:

2

Hi guys,

I'm running an Apache2 web server with a dynamic IP address. I bought exampledomain.net, and I use no-ip.com's domain-update service to redirect any visitors to my current ip address (endnote #1). For example, someone visits exampledomain.net and they get redirected to 73.181.57.34. It works like a charm. However, it isn't all that user-friendly. Can I rewrite the redirected, ip-address URL?

I tried these rewrite rules in the root folder's .htaccess...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^73\.181\.57\.34:88
RewriteRule ^(.*)$ http://www.exampledomain.net/$1 [L,NC]
# I simplified the RewriteCond. I would use regex in a real situation.

Of course, this creates an infinite loop. The user visits www.exampledomain.net. They're redirected to 73.181.57.34:88 by no-ip. Apache redirects them to www.exampledomain.net which redirects them back to 73.181.57.34:88... so on and so forth.

I'm a noob when it comes to rewriting, but is there a way to rewrite a URL without redirecting?

I tried these rewrite rules too (a shot in the dark)...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^73\.181\.57\.34:88
RewriteRule ^(.*)$ my.exampledomain.net/$1 [L,NC]
# I'd read that Apache replied with a redirect header when you include http

Of course, this doesn't work because my.exampledomain.net doesn't really exist.

Thanks!


(1) No-IP works like this: You download and install their dynamic update client on your server. Every couple of minutes it polls your server for its current external ip address. If it's changed, it updates your server's ip address in no-ip's records.

A: 

No. For example I can't show you my website and have http://yourbank.example.com in the address bad.

Gareth
A: 

Oh. Haha. Well when you put it like that, that makes sense. Thanks Gareth.

Jack
Doesn't No-IP allow you to just let it work as a DNS mapping? For my subdomain there, I've just chosen a plain A record, so the domain doesn't actually redirect - it's just a DNS record so clients connect to my IP when using my domain.
Michael Madsen