LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 02-10-2005, 03:48 PM   #1
gonzo22
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Rep: Reputation: 0
Redirection in Apache


Hello,

I need to redirect from Apache to a different directory on the server. This is what I am trying to accomplish

something.com redirected to something.com/someone

The domain name will stay the same just need to pointed a directory deeper.

Thanks,

konrad
 
Old 02-11-2005, 03:43 AM   #2
BinaryBob
Member
 
Registered: Aug 2002
Posts: 117

Rep: Reputation: 15
Look into another form of redirection. I've never done this directly inside of apache, and its prolly not even the best way to do it. Try, javascript, if you don't want to do it server side. But if you d`want to do it server-side, I'd go with PHP, then you can send the correct HTTP redirection header, and what you want would be carried out.
 
Old 02-11-2005, 03:50 AM   #3
overlord73
Member
 
Registered: Apr 2004
Location: ..where no life dwells..
Distribution: RH,FC/SuSE/Debian/HPUX/OSX
Posts: 511

Rep: Reputation: 30
..if u want to configure it inside of apache, look for mod_rewrite....or use a script! ;-)
 
Old 02-11-2005, 04:21 AM   #4
BinaryBob
Member
 
Registered: Aug 2002
Posts: 117

Rep: Reputation: 15
Yeah mod_rewrite will do some crazy stuff, but tricky to configure sometimes. Here's a link to it's config info:
http://httpd.apache.org/docs/misc/rewriteguide.htm

(I strongly recommend, a script method though, like my first post described)
 
Old 02-11-2005, 04:31 AM   #5
angrybeaver
Member
 
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 16
mod_alias will let you add a permenent redirect to wherever you want. Doc for this directive is here .

If you want to redirect your documentroot, your alias will be /

... or you can add a redirect metatag to the HTML source of your index.

<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=someotherurl">
</HEAD>

no crazy php client header management or javascript required...

Either way, the browser needs to refetch the page, so your choice. Having apache handle the redirect is better, as it will redirect *all* requests for that alias. Not just simply on one or two hypertext sources.

but... if its on the same box, why not just adjust your DocumentRoot ?????

Last edited by angrybeaver; 02-11-2005 at 04:40 AM.
 
Old 02-12-2005, 09:54 AM   #6
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
in regards to meta refresh, i prefer script alternative... can't remember why i started using these, just that i ran into a problem with a meta refresh somewhere...

though if this is a standing redirect, i would let apache handle it...

Code:
<html>
  <head>
    <title>Redirecting</title>
  </head>
  <body>
    <script type="text/javascript" language="Javascript">
      <!--
      document.location="somewhere.html";
      //-->
    </script>
    <noscript>
      Your mother was a hampster and your father smelt
      of elderberries.
      <a href="somewhere.html">This page has moved</a>
    </noscript>
  </body>
</html>
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache - Website Redirection Help cbarone2005 Linux - Software 2 09-29-2005 02:45 PM
redirection in C pantera Programming 2 08-11-2004 01:06 PM
Apache redirection question... WeNdeL Linux - Software 2 04-01-2004 10:48 AM
Apache - Redirection problem... elitecodex Linux - Software 5 03-29-2004 10:12 PM
apache redirection failing acid_kewpie Linux - Networking 2 08-15-2002 04:29 PM


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

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