Apache Mod rewrite in Centos 6.2
Hi all
I Have a single ipaddress with multiple domain mapped to it .How can i rewrite my url http://example.in to http://10.200.2.0/home. http://example.com should point to http://10.200.2.0 example.com - http://10.200.2.0 example.in - http://10.200.2.0/home |
well initially that'll be a mod_proxy issue, not rewrite.
ProxyPass http://example.com http://10.200.2.0 ProxyPassReverse http://example.com http://10.200.2.0 You might well not need any rewriting depending on what the content is. |
Thanks for ur reply,
I had tried out these mod_rewwite rules but it never works RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301] Then i tried out these using proxypass ProxyPass http://example.in http://10.200.2.0/home ProxyPassReverse http://example.in http://10.200.2.0/home when i hit example.in it pointing to http://10.200.2.0 |
Quote:
Code:
<VirtualHost *:80> |
Hi
When i had a restart example.com works fine ,example.in delivers 502 proxy error Whether it neccesssary to have two virtual host since example.in accessing same example.com directory /home folder.whether its easier to achieve my configuration by mod rewrite are else by proxypassReverse httpd-example.com Quote:
httpd-example.in Quote:
|
Hi,
The 502 error you get could be due to a variety of reasons. So take a look at both apache and the backend server's logs. I guess the backend is a tomcat server, so keep in mind that if you use a reverse proxy configuration like the one I've posted above, there is no need to for anything related to mod_jk. You should choose only 1 method of connecting to tomcat, either by mod_jk, or through a reverse proxy setup. Also the various Alias, <Directory ...> etc, are useless in the latter case Regards |
You can achieve these by mod _rewrite rather than ProxyPassReverse
<VirtualHost *:80> ServerName example.in #/**added this**/ RewriteEngine on RewriteCond %{REQUEST_URI} !^/home(.*)$ RewriteRule ^/(.*)$ http://10.200.2.0/home$1 [R,L] #/**end**/ </VirtualHost> |
All times are GMT -5. The time now is 03:46 AM. |