LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-02-2003, 08:56 AM   #1
fibbi
Member
 
Registered: Sep 2003
Distribution: gentoo
Posts: 101

Rep: Reputation: 16
apache redirect?


I was wondering if there's any way to configure my apache2 server to redirect rather than deliver specific page. Basically, i have movabletype installed on my webserver, but its a pain in the ass to type http://www.mydomain.org/cgi-bin/mt.cgi every time i want to make a new entry. While I could make a file like /login.html, i'd still rather not have to have the .html part. So, is there any way to configure apache to recognize a url (ie /login) and redirect it somewhere?

Or, if not, any other suggestions?
 
Old 12-02-2003, 12:45 PM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
You could do that with an Alias I believe:
Alias /thisrocks.php "whatever/wherever/whoever/cgi-bin/mt.cgi"

Remember to restart Apache after making your changes.

Cool
 
Old 12-02-2003, 01:07 PM   #3
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
You've got several options :
using mod_alias: Redirect permanent /foo http://server/bar
using mod_rewrite: RewriteRule ^/foo$ /bar [R,L]
 
Old 12-02-2003, 01:13 PM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Thanks stickman! I have recently been thinking of a better way to do something I've been doing with Alias, rewrite is by far the way to go (for me), I had totally forgotten about that option.

Cool
 
Old 12-02-2003, 01:53 PM   #5
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
I really like mod_rewrite. It turns those really long URLs into nice short ones pretty easily.
 
Old 12-02-2003, 08:05 PM   #6
fibbi
Member
 
Registered: Sep 2003
Distribution: gentoo
Posts: 101

Original Poster
Rep: Reputation: 16
thanks! I did it with alias, because it seemed that this mod_rewrite didn't show up when i type apachectl -l, so it might have taken more work to set up.


What are the advantages of using rewrite, and what makes it different from alias?

Thanks
 
Old 12-03-2003, 11:23 AM   #7
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Once of the things that I like about mod_rewrite is that you can turn this:
http://server/cgi-bin/script.cgi?var1=value1&var2=value2&var3=value3
into this:
http://server/value1/value2/value3

Just imagine:
http://server/cgi-bin/script.cgi?dept=accounting&name=john_doe
can be shortened to:
http://server/accounting/john_doe

mod_rewrite has quite a few features to rewrite URLs based on multiple conditions such as referrer, browser, etc.

Last edited by stickman; 12-03-2003 at 11:26 AM.
 
Old 01-30-2004, 10:41 PM   #8
Sm0k3
Member
 
Registered: Sep 2003
Location: Chicago
Distribution: Slackware-current
Posts: 63

Rep: Reputation: 15
dangit, i didn't see this thread before i started my own related to this topic.. the thread i started, if i knew how to construct a rewrite rule so i could change http://server/cgi-bin/script.cgi?file=whatever to http://server/downloads/whatever could have saved me and you guys's time, sorry about the mess
 
  


Reply



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
Apache VirtualHost Redirect Problem... SiLiCoN Linux - Networking 5 05-03-2005 08:41 AM
redirect traffic through apache kola Linux - Networking 7 12-11-2004 07:29 AM
apache redirect question twk Linux - Networking 2 10-23-2004 01:03 AM
redirect in Apache baslemmens Linux - Networking 6 09-02-2004 12:07 PM
How to redirect apache to tomcat? gepesz Linux - General 0 07-29-2004 09:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:03 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration