Htaccess rewrite

Posted on 2009-04-29
Last Modified: 2012-05-06
I've got two virtual host configurations that allow me to manage a couple domains with the same IP. The virtual host configurations are working as expected and I don't see the need to make any updates, but I've provided them anyway for context.

<VirtualHost *:80>
DocumentRoot "\path\www"

<VirtualHost *:80>
DocumentRoot "\path\www\domain2"

My problem is that my domain1 root is actually located at "\path\www\domain1" but I cannot virtual host to the domain root because it messes up all of the paths for the app that's installed in \domain1. I could move the \domain1 app to the web server root directory and I think all of my problems would be fixed, but that requires a re-install that I'm trying to avoid.

Basically, I think the solution would need to be an .htaccess rewrite that caught all requests for and redirected it to I've tried a simple redirect, but it catches all requests sent to as well, which is not what I want.

I'd guess that I'm making this more complicated than it needs to be. Any feedback is appreciated.
Question by:FirePits
    LVL 27

    Accepted Solution

    Did you try

    Redirect 301 /index.php

    in your <virtualhost *:80>
    LVL 1

    Author Comment

    I didn't know you could put that in the virtualhost directive....Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now