Virtual Directory

Posted on 2005-03-08
Medium Priority
Last Modified: 2013-11-15
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/

Question by:SWB-Consulting
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Author Comment

ID: 13493158
one more thing: i want it to be done in the htaccess file not in the httpd.conf
LVL 51

Expert Comment

ID: 13493548
use mod_rewrite:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^/somedirectory(.*)$ /$1 [R,L]

Author Comment

ID: 13501641
I tried it in the .htaccess but it didn't work. It didn't find the address http://localhost/domedirectory/
LVL 51

Expert Comment

ID: 13503626
which .htaccess, that in domedirectory?
you better write these rules in httpd.conf
LVL 27

Accepted Solution

caterham_www earned 2000 total points
ID: 13504979
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.

RewriteEngine On
RewriteRule ^somedirectory/?(.*)$ /$1 [L]

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question