apache2 - Apache rewrite rule for converting request subdomain to destination domain? -


i trying create proxy -

www.google.com.myproxy.com/path?query -> www.google.com/path?query

i new apache2 , able come following rewrite rule based on understood documentation -

rewriteengine on rewriterule ^(.*)\.localhost\.com(.*)$ $1$2 [p] 

in rewrite rule, if goto www.google.com.myproxy.com seeing apaches home page i.e. same content see if go myproxy.com directly. missing here?

i figured out correct rewrite rules -

hostnamelookups on rewriteengine on rewritecond %{http_host} ^(.*)\.myproxy\.com$ rewriterule ^(.*)$ http://%1$1 [p] 

using able proxy content using -

www.reddit.com.myproxy.com/r/india  

from

www.reddit.com/r/india 

thanks following documentation - http://httpd.apache.org/docs/2.2/rewrite/vhosts.html


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -