LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
LinkBack Search this Thread
Old 10-16-2008, 06:33 PM   #1
nitrohuffer2001
Member
 
Registered: Apr 2006
Posts: 129

Rep: Reputation: 16
Squid - URL Rewriting


Hey fellas, I have a bit of an issues with a squid setup. Here is my problem:
I have some people who do not like to type and they often have to go to a url outside of work to use a required application. so say they have to go to http://www.some-app/application/whatever.asp

The request is to make it so they can just type http://www.some-app and the url is then automatically forwarded / rewritten to the long version.

Can I do this with our proxy server? We have a squid box in play buy I do not know how or where to begin to start the config.

Thanks in advance.
 
Old 10-23-2008, 07:44 PM   #2
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
You can do this with Squid by using a redirector.

I used this one back in the day to make sure HTTPS would always be used for Gmail:
Code:
#!/usr/bin/perl
$|=1;
        while (<>) {
                @X = split;
                $url = $X[0];
                if ($url =~ /^http:\/\/gmail\.google\.com/) {
                        print "302:https:\/\/gmail\.google\.com\n";
                }
                elsif ($url =~ /^http:\/\/www\.gmail\.com/) {
                        print "302:https:\/\/gmail\.google\.com\n";
                }
                elsif ($url =~ /^http:\/\/gmail\.com/) {
                        print "302:https:\/\/gmail\.google\.com\n";
                }
                else {
                        print "$url\n";
                }
            }
I don't know Perl, I just based it off of an example I got from the Squid documentation.

It should be fairly easy for you to modify it to your needs.

Last edited by win32sux; 10-23-2008 at 07:45 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URL rewriting for sub-domain scls19fr Linux - Server 6 10-05-2008 11:56 PM
URL Rewriting mrpraveen.p Linux - Newbie 1 06-03-2008 07:07 AM
URL Rewriting getmeontop Linux - Newbie 1 04-02-2008 02:12 AM
url rewriting in localhost pamount Red Hat 0 01-08-2008 08:10 PM
Mod REWRITE url rewriting gabsik Linux - Networking 1 09-29-2006 05:24 AM


All times are GMT -5. The time now is 04:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration