[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Redirect domain to URL Mapping

Posted on 2011-03-03
16
Medium Priority
?
983 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
What You Need to Know when Searching for a Webhost Provider
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 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