Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Redirect domain to URL Mapping

Posted on 2011-03-03
16
Medium Priority
?
978 Views
Last Modified: 2012-05-11
I currently have a unix box where I have an HTTPServer that directs httprequests to a cluster of Portal servers which use IBM Portal Server 6.1.  On the Portal intances, I want to have some friendly URLs like this: www.mymainsite.com/wps/portal/MYSUBSITE  but I want to be able to make the "/wps/portal" disappear for the end user using a second domain name like this:  www.mysubsite.com

I was told that I can somehow redirect "www.mysubsite.com" to www.mymainsite.com/wps/portal/MYSUBSITE .  I have already added "www.mysubsite.com" to my Portal Plugin file to allow ports 80a nd 443 to pass to the portal but how do I redirect the URL in the httpd.conf file ?

Any ideas?
0
Comment
Question by:bganoush
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
16 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35030083
You can use iptables NAT option to use transparent Squid web proxy server
ptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

Open in new window



The Squid example are documented here:
http://wiki.squid-cache.org/ConfigExamples/Authenticate/Bypass 
0
 

Author Comment

by:bganoush
ID: 35030121

??
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35030155
Ok.

Try this

 
iptalbes -t nat -A PREROUTING -d www.mysubsite.com -p tcp --dport 80 -j DNAT --to www.mymainsite.com/wps/portal/MYSUBSITE

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 31

Expert Comment

by:farzanj
ID: 35030165
Sorry, iptables no iptalbes
0
 

Author Comment

by:bganoush
ID: 35030944

I don't know if I have access to the "squid" server, if we have one...   I have an HTTPServer and was hoping to modify the httpd.conf file using something like the "Rewrite" commands....

0
 
LVL 31

Expert Comment

by:farzanj
ID: 35031064
In my second comment, I just told you to use iptables alone, no Squid.
0
 

Author Comment

by:bganoush
ID: 35031084

where does that go? in teh httpd.conf file?
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35031114
It is firewall setting.

You have to type it up on the command line and then do this

service iptables save

The above command works for Redhat/CentOS.  For other flavors you will have to see who to save your iptables settings.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35031176
What kind of Linux are you using?  Could you make it to work?  Try doing man iptables and see options for saving iptables if you don't have Redhat/CentOS/Fedora
0
 

Author Comment

by:bganoush
ID: 35083022

We are running everything from AIX ...  that's why I would prefer to modify the httpd.conf file instead, this solution would also be cross-platform.  I'm not sure if I can use your solution on all servers, especially windows...
0
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 35083936
Ok.  You can use .htaccess files.  Or if you want to modify the httpd.conf file here it goes.

Make sure the following module line is present and uncommented
LoadModule rewrite_module modules/mod_rewrite.so

Open in new window


Before we can rewrite, there is one option we must first set: FollowSymLinks. This is a security feature of the rewrite engine and you will not be able to rewrite without this option. In most cases, this will already be set in the server httpd.conf but you can safely state it again

The final requirement is to turn the rewrite engine on. I recommend you begin all your rewriting code with the following three lines, but you may not need the first two:

 
LoadModule rewrite_module modules/mod_rewrite.so

Open in new window


Then you can use RewriteRule  to change your URL.

Appears that you would need the following rule
RewriteRule www.mysubsite.com  www.mymainsite.com/wps/portal/MYSUBSITE
Options +FollowSymLinks
Options +Indexes
RewriteEngine On

Open in new window

0
 

Author Comment

by:bganoush
ID: 35098894


So my final httpd file will contain something like this:


LoadModule rewrite_module modules/mod_rewrite.so
Options +FollowSymLinks
Options +Indexes
<VirtualHost *>
    RewriteEngine On
    RewriteRule www.mysubsite.com www.mymainsite.com/wps/portal/MYSUBSITE
</VirtualHost>

Open in new window

0
 

Author Comment

by:bganoush
ID: 35098897

Does that make sense?
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35099461
Just uncomment line
LoadModule rewrite_module modules/mod_rewrite.so
it is there by default


You should have options in <Directory> or similar tag
For example:
 
<Directory /usr/local/httpd/htdocs>
Options +FollowSymLinks
Options +Indexes
</Directory>

Open in new window


Then test it and tell me whether it works or if not, what is the error or problem
0
 

Author Comment

by:bganoush
ID: 35180707

Thanks.. I'm still working on this but I have been pulled away to another project until the end of this week.. I'll try what you said once i can get back on it.
0
 

Author Closing Comment

by:bganoush
ID: 36130962
Thanks,

I went with a reverse proxy instead.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question