Jump to content

Need help getting Apache to rewrite URL


sundansx

Recommended Posts

I have an winXP apache 2.2.4 webserver on my FIOS setup that listens on Port 81 (fios blocks incoming port 80).  I have a domain at Godaddy called somedomain.net.  Godaddy is setup to utilize zoneedit.com's nameservers.  zoneedit is setup to redirect any traffic to www.somedomain.net to somedomain.net:81 to simplify urls for family members (especially the home url of www.somedomain.net).  This works great, but once someone types http://www.somedomain.net into their browser, they get redirected to http://somedomain.net:81 - that is what is displayed in their url address bar.  Any further links they click on my website are addressed http://somedomain.net:81/somepath.  I am trying to figure out a way to get apache to rewrite the url info and pass the simple url (www.somedomain.net/somepath) back to the browser and all links. 

I tried this with mod_rewrite, but it gets stuck in a loop (maxRedirects does not seem to help):

RewriteEngine on

#RewriteOptions MaxRedirects=1
# For sites running on a port other than 80
RewriteCond %{HTTP_HOST}   somedomain\.net.* [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{SERVER_PORT} 81$
#RewriteRule ^/(.*)         http://www.somedomain.net/$1 [L,R]

 

from the mod_rewrite log, it appears that the match happens, and the user's browser is redirected to www.somedomain.net, which is then zoneedit/godaddy redirected to somedomain.net:81, which is then matched and redirected to www.somedomain.net.....ad naseum...

 

I am wondering if mod_rewrite is the right tool for this task.  I have also played with ProxyPass/ProxyPassReverse without success so far.

I suspect I might have to use something in apache to rewrite a env variable like HTTP_HOST so that the browser will adjust their links for relative paths.

 

Anybody have any ideas?  Any help is appreciated.  thanks.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.