# htaccess Rewrite fake folder to folder in cgi-bin



## SecretAgentW (Jul 24, 2003)

Ok, guys I have literally worked on this problem for 5 hours now.

This is the structure of a perl program I want to use:

cig-bin/proggy/

And I want my users to see:

/proggy

Which is fine, but I have run into a snag. There are two programs in that directory.

mainproggy.pl
adminproggy.pl

Each one runs independantly. The problem lies is when I get a successful rewrite of mainproggy.pl, it kills adminproggy.pl when I try to run it (redirects it to mainproggy.pl). I really don't give a damn if I have to go to the ugly url cgi-bin/proggy/ to run the admin end - but I can't get them independant of each other (program's settings for web url and other stuff are shared in a common config file for both the main and the admin - I won't be able to update mainproggy on the fly using adminprogggy if I make 2 config files).

Every single resource and tutorial out there give me instructions on how to forward an entire directory to a _specific file_ - but I can't figure out how to forward the _entire directory_ to another directory.

Examples of what I have tried (some may cause  but please keep in mind I was desperate to get it to work.) I put the .htaccess file in the /proggy/ directory:


```
RewriteEngine on
RewriteRule ^/?(.*)$ /cgi-bin/proggy/index.pl$1
```


```
DirectoryIndex index.pl
RewriteEngine on
RewriteRule ^/index\.pl(.*)$ /cgi-bin/proggy/index.pl$1
```


```
RewriteEngine on
RewriteCond  %{REQUEST_URI} !adminproggy.pl
RewriteRule ^/(.*)$ /cgi-bin/proggy/index.pl$1
```
Oh, and all sorts of others, but I figure this is enough.

Help.


----------



## SecretAgentW (Jul 24, 2003)

Good lord, I got it!!!


```
RewriteEngine on
RewriteRule ^/?(.*)$ /cgi-bin/proggy/$1
```
I could have SWORN I already tried this, but I must have had an error in my syntax before.

Well, sometimes it takes showing it to the world for you to see it yourself.


----------

