Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Rewriting...

Status
Not open for further replies.
What you really want is the reverse

Try this. Make your primary site entry point :


Then use proxypass and proxypassreverse

Code:
ProxyPass / [URL unfurl="true"]http://www.site.com:8000/[/URL]
ProxyPassReverse / [URL unfurl="true"]http://www.site.com:8000/[/URL]

This requires an apache listening on port 80 of course.

You can get more tricky with mod_rewrite but if you don't know that you need it then you probably do not need it.
 
Well I have two different sites on the same machine. I am using ssl on both sites by running each site on a different port number. (8000 and 9000) I have it setup when someone types in it automatically redirects them to And the same for the second domain when someone types it redirects to I just do not want the port to be visible in the address bar for these sites. Will the code you typed above work in this situation? Thanks
 
Because I have 2 ssl vhosts on one ip and each vhost has to be bound to a different port number.
 
why is that? I have well over 100 vhosts running on the same box with a single IP address...

Code:
NameVirtualHost YOUR_IP_ADDRESS

<VirtualHost YOUR_IP_ADDRESS:80>
        ServerName [URL unfurl="true"]www.domain.com[/URL]
        ServerAlias domain.com
        .. bla bla bla....
</VirtualHost>


Just change the port 80 to 443 and set your ssl params in the vhost and your in business.
 
Yes but that will not work for ssl enabled vhost. I think I tried that when I set it up. SSL does not know how to handle host headers. That is why I have a vhost setup on port 80 so that when someone types in it redirects to If I didn't do that I would have to tell the person to visit my website at which would really suck. See where I am going here?
 
Hmm, works on my ssl servers.

Bottom line, if your doing an actual redirect you can't hide the URL. You can only do that with a reverse proxy which in your case is not useful since your IP limited.

John
 
I'm using stronghold but its apache based so this should work for you as well, from the stock config

Code:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at <URL:[URL unfurl="true"]http://www.apache.org/docs/vhosts/>[/URL]
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /[URL unfurl="true"]www/docs/dummy-host.example.com[/URL]
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

#<VirtualHost _default_:*>
#</VirtualHost>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top