Howto redirect to another folder in Apache

Posted on 2008-10-27
Medium Priority
Last Modified: 2012-05-05

As an example
In the DNS record there is one domain that is called "doman.nu" and points to doman.nu has a standard homepage.

There is also one "min.doman.nu" and points to the same IP this one has a different homepage and are in another folder.

When I go to min.doman.nu I want apache to look up http://min.doman.nu/ and redirect me to another folder that is called test.

I thought that it was like this:

ServerName min.doman.nu
ServerAlias min.doman.nu/test/
Redirect permanent / http://min.doman.nu/test

What more do i have to do? its only one homepage on that webserver

Its an old FreeBSD with apache version 1.6 or something
do i have to activate virtual host in someway?

Question by:tommyrihu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 27

Accepted Solution

caterham_www earned 200 total points
ID: 22815590
You need a virtualhost for both domains
NameVirtualHost *:80
<VirtualHost *:80>
ServerName doman.nu
ServerAlias www.doman.nu
DocumentRoot /physical/path/to/doc/root
<VirtualHost *:80>
ServerName min.doman.nu
RedirectMatch permanent ^/$ http://min.doman.nu/test/
DocumentRoot /physical/path/to/min/doc/root

Open in new window


Author Closing Comment

ID: 31510454
Thank you very much for your good explanation.

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month11 days, 21 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question