Solved

Redirect domain to URL Mapping

Posted on 2011-03-03
16
959 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
 
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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 500 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS Site Configuration Copy 2 71
Bulk Changes to WP permalinks in .htaccess - blog post only 4 78
ip / url redirect 13 68
DNS @ Naked Domain Record 5 69
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now