User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Linux Servers and Apache section within the Tech Talk category of DaniWeb, a massive community of 402,977 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,657 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Linux Servers and Apache advertiser: Programming Forums
Views: 447 | Replies: 0
Reply
Join Date: Jan 2008
Posts: 28
Reputation: atlex2 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
atlex2 atlex2 is offline Offline
Light Poster

mod_rewrite to hide subdirectory

  #1  
Jul 7th, 2008
Hello,

I need to hide an embedded directory in a URL site2.com/site2files/ <-- need to remove that and just see site2.com for the files in /site2files/

Here's a visual representation of my file system.

site1.com
Document root:
-file
-file.html
-folder/
-site2folder/ (Important!)
-file
-functions/ ::need to be accessed by site2

site2.com --if it wasnt auto re-routed to /site2folder/
Document root:
-file
-file.html
-folder/
-site2folder/
-file
-functions/ ::need to be accessed by site2

site2.com/site2folder/
site2folder:
-file.html
-folder/
-file

site1.com and site2.com both point to the same server.
I can't use virtual servers or mod_rewrite document root because I need the documents in site1.com accessible by site2.com
I have requests for site2.com rerouting to site2folder/ using php header("Location: and $_SERVER
I don't want my users to see site2.com/site2folder/ I want them to see site2.com/ and still access the files in /site2folder/. I was thinking mod_rewrite but I'm terrible at that..
Again I want to pretend like the directory doesn't exist and just use the top-level domain.

Thanks!
BTW
--I found this online and it DOESN'T work
Am I doing something wrong?

RewriteCond %{HTTP_HOST} ^(w{1,3}\.)?site2\.com$
RewriteCond $1 !^site2folder/
RewriteRule (.*) /site2folder/$1 [L]
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Linux Servers and Apache Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Linux Servers and Apache Forum

All times are GMT -4. The time now is 8:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC