• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 555
  • Last Modified:

Htaccess rewrite

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>
ServerName domain1.com
DocumentRoot "\path\www"
ServerAlias www.domain1.com
</VirtualHost>

<VirtualHost *:80>
ServerName domain2.com
DocumentRoot "\path\www\domain2"
ServerAlias www.domain2.com
</VirtualHost>

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 www.domain1.com/index.php and redirected it to www.domain1.com/folder/index.php. I've tried a simple redirect, but it catches all requests sent to www.domain2.com/index.php 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.
0
FirePits
Asked:
FirePits
1 Solution
 
caterham_wwwCommented:
Did you try

Redirect 301 /index.php http://domain1.com/folder/index.php

in your <virtualhost *:80>
?
0
 
FirePitsAuthor Commented:
I didn't know you could put that in the virtualhost directive....Thanks
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now