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
https://forums.phpfreaks.com/topic/117471-need-help-getting-apache-to-rewrite-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.