Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


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

Rep: Reputation: 0
Redirection in Apache


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

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


Old 02-11-2005, 03:43 AM   #2
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
Registered: Apr 2004
Location: ..where no life dwells..
Distribution: RH,FC/SuSE/Debian/HPUX/OSX
Posts: 518

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

(I strongly recommend, a script method though, like my first post described)
Old 02-11-2005, 04:31 AM   #5
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.

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

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

    <script type="text/javascript" language="Javascript">
      Your mother was a hampster and your father smelt
      of elderberries.
      <a href="somewhere.html">This page has moved</a>


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 > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration