Help with a rewrite rule

Using a single web hosting account to host multiple sites

Help with a rewrite rule

Postby ediruzza » Fri Mar 30, 2007 6:17 am

We've been racking our heads trying to figure out what the syntax should be for this ReWrite Rule...

Here's what we are trying to do.

- We have a secured domain - it's called "https://ssl.mydomain.com"
- All the code for the domain is in the directory "f:/webstuff/code"
- There are additional folders beneath the 'code' folder (up to 5 levels deep)

So far, pretty simple...

- We are setting up clients with their own login in name, i.e. client1, client2, client3, etc.
- We would like to trap the clients name within the URL, however, we still want to redirect them to the main directory "F:/webstuff/code"
- Basically, the URL would look something like this for the above clients.
"https://ssl.mydomain.com/client1/index.php"
"https://ssl.mydomain.com/client2/index.php"
"https://ssl.mydomain.com/clientN/index.php"

- Obviously, we don't want to create a 'clientN' folder for each client.
- We just want to redirect them back to the main folder.

Here's what we have in the ssl.conf file. (we are running Apache 2.0.37)

RewriteEngine On
RewriteRule (.*)/(.*) f:/webstuff/code/$2

The problem with this code is that any attempt to get past the 'code' folder results in an error 404.

If I put 'somecode.php' in "f:/webstuff/code" folder then,
"https://ssl.mydomain.com/client1/somecode.php" works...but, if I put 'somecode.php' in "f:/webstuff/code/folder1/folder2/" folder then,
"https://ssl.mydomain.com/client1/folder1/folder2/somcode.php" does not work...we get error 404

I'm sure this is pretty simple...but we are new at this...

Thanks in advance to anyone who can help.

Ed
ediruzza
 
Posts: 2
Joined: Fri Mar 30, 2007 6:00 am

Postby richardk » Fri Mar 30, 2007 12:03 pm

Code: Select all
RewriteEngine On

RewriteRule /([^/]+)$ f:/webstuff/code/$1 [QSA,PT,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby ediruzza » Wed Apr 04, 2007 3:27 am

Thanks...that helped out quite a bit and we finally got it working.

You are a lifesaver.
ediruzza
 
Posts: 2
Joined: Fri Mar 30, 2007 6:00 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 44 guests

cron