Welcome to the most active Linux Forum on the web.
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


  Search this Thread
Old 10-16-2008, 07:33 PM   #1
Registered: Apr 2006
Posts: 165

Rep: Reputation: 19
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, 08:44 PM   #2
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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:
        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 08:45 PM.


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

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

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

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