Monday, July 27, 2009

Proxy setting in apache or Url with out port number

Here you can see the example for proxy setting in your apache or redirecting your site in to other site with in your apache configuration

You may facing problem of getting port number in url when your having same server with different port usually by default your server will be set to port 80 if you are having a different site on same server but with different port if you try to run site u will get the port number in url this may be looking ugly. So here is solution to over come this problem

The below example shows you how do proxy setting in apache

Ste1. enable proxy module in side your apache configuration file (http.conf) in side conf folder

LoadModule proxy_module modules/mod_proxy.so

#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

LoadModule proxy_http_module modules/mod_proxy_http.so

Step2. paste the following code inside http.conf

ProxyRequests off


Order deny,allow
Allow from all


ProxyPass /site1 http://www.example.com/stie1

Like this you can have different site in single port number first time when you enter www.example.com this is basic site if user mention www.example.com/stie1 then this should goes to different application

How to remove port number from url

Here you may be getting your site url like this example:8222/index.php problem here is you may be having different site on same server but with different port number .but this looks ugly… to remove the port number from the url use the same method of proxy


Order deny,allow
Allow from all


ProxyPass /site1 http://example:8222/stie1

When you enter the www.example.com this proxy setting will redirect your site to the site1 folder but the url name remain same as www.example.com

1 comment:

Anonymous said...

haven't tried yet but thanks a lot for the info!
straight to the point just at it's supposed to be.

cheers