logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reroute subdir to virtual site
Author
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Mon 11 Sep '06 23:02    Post subject: Reroute subdir to virtual site Reply with quote

Hello,

Can't figure out how I can get this to work.

I have installed my default website (site1) on Apache.
By using virtual hosts, I added 2 other sites (site2 & site3).

When I go to: http://site1 , I get site 1. So far so good.
However I want to achieve that when users type in http://site1/site2
People are routed to site2.

Is there a way to route this subdirectory to 'site2'?

If possible an example of modrewrite (or something I have to use to get this done).

Regards.
Back to top
DeliriumServers



Joined: 17 Jun 2006
Posts: 54
Location: H Town

PostPosted: Mon 11 Sep '06 23:24    Post subject: Reply with quote

an easy way would be to make an alias, then the request isn't processed so much each time as it would be with rewrite (although with just a few sites it's unnoticable anyways)

try this in your conf (of course changing everything to where site2 is located and make the paths correct (you don't need the directory definition here, i just felt like including, all you really need is the first line)

Code:
Alias /site2 "F:/www/site2"

<Directory "F:/www/site2">
AllowOverride All
Order allow,deny
Allow from all
</Directory>


this means on any site you host if anyone does http://somesite/site2 it will draw the site out of the directory you have defined
Back to top
DeliriumServers



Joined: 17 Jun 2006
Posts: 54
Location: H Town

PostPosted: Mon 11 Sep '06 23:32    Post subject: Reply with quote

if you still want a rewrite rule I recommend looking around http://forum.modrewrite.com/ they will either have one or if you request someone will make one for you, it's a very nice community

-delirium
Back to top
DeliriumServers



Joined: 17 Jun 2006
Posts: 54
Location: H Town

PostPosted: Mon 11 Sep '06 23:38    Post subject: Reply with quote

oh I'm sorry I think I may have misunderstood your situation completely...

if you want http://site1/site2 to auto turn into http://site2 the easiest thing to do imo is to make a .htaccess redirect in the folder

make a .htaccess file in the site1 folder

and put this in it

Code:
Redirect /site2 http://site1.com/


make sure apache is listening for .htaccess files too, there should be a post somewhere in this forum about that.


hope I helped, sorry for all the posts
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Tue 12 Sep '06 9:41    Post subject: Thanks! Reply with quote

Thanks for the info!

Working like a charm. The Alias is also very handy Wink

Regards.
Back to top
DeliriumServers



Joined: 17 Jun 2006
Posts: 54
Location: H Town

PostPosted: Tue 12 Sep '06 22:18    Post subject: Reply with quote

glad I could help, so which way did you end up using?
Back to top


Reply to topic   Topic: Reroute subdir to virtual site View previous topic :: View next topic
Post new topic   Forum Index -> Apache