Virtual Directory

I use Apache 1.3

I'd like to have a virtual directory so that when the user accesses
http://localhost/somedirectory/ he in fact accesses http://localhost/ but thinks he's in http://localhost/somedirectory/

Thanks,
Nima
SWB-ConsultingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SWB-ConsultingAuthor Commented:
one more thing: i want it to be done in the htaccess file not in the httpd.conf
0
ahoffmannCommented:
use mod_rewrite:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^/somedirectory(.*)$ /$1 [R,L]
0
SWB-ConsultingAuthor Commented:
I tried it in the .htaccess but it didn't work. It didn't find the address http://localhost/domedirectory/
0
ahoffmannCommented:
which .htaccess, that in domedirectory?
you better write these rules in httpd.conf
0
caterham_wwwCommented:
for so called per-dir context (.htaccess; <Directory> and <Location> containers in httpd.conf), the pattern of a rewriteRule does not start with a leading slash. If you need an external redirect (-> url changes in the locationbar), add the R-Flag ([R=301,L]). Make sure you're sending a statuscode 301 moved permanently, otherwise search engines will not follow this redirection.

####http://localhost/.htaccess##
RewriteEngine On
RewriteRule ^somedirectory/?(.*)$ /$1 [L]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.