Forum Moderators: phranque
RewriteRule ^(.*)$ [255.255.255.0:10255...] [R=301,L]
...and it's not working. The same line works fine for a valid domain name.
My questions:
Does the redirect mod support this kind of forwarding?
Is there any other way of achieving my goal?
Cheers
Adam
If that's not clear, picture it this way: It is impossible to have a single TCP/IP connection that is both outgoing and incoming from the same machine or router at the same time. If the request is routed to the outside of your router, then there is "nothing out there" -- no "agent" to send the request back into the router and to your server.
Jim
What you are describing should work, so the problem is identifying "What, specifically, does not work?" and "Where, specifically, is the problem occurring?"
The only thing I see wrong is that your rule will drop the "page" part of the URL, and might be better written as
RewriteRule ^(.*)$ http://123.45.67.87:8080[b]/$1[/b] [R=301,L]
Also, if you have no other working mod_rewrite rules in the subdomain's subdirectory .htaccess file, you will need to enable mod_rewrite using the second (and quite possibly both) of the two initial lines here:
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^(.*)$ http://123.45.67.87:8080/$1 [R=301,L]
Also, use a good HTTP headers checker, such as the "Live HTTP Headers" extension for Firefox/Mozilla browsers, to see what --if any-- response you're getting from the subdomain server. You should be seeing the 301-redirect response as specified in the .htaccess file.
Jim
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^#*$!.#*$!.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.#*$!.#*$!.co.uk$
RewriteRule ^(.*)$ [255.255.255.255:10255...] [R=301,L]
This structure works fine, thanks a lot.
Adam
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?xyz\.abc\.co\.uk
RewriteRule (.*) http://255.255.255.255:10255/$1 [R=301,L]
It also handles both the www and non-www hostnames with one RewriteCond.
The literal periods in the domain name should be escaped as shown.
Since ".*" is a greedy pattern and stands alone here, there's no need to anchor it.
Jim