?
Solved

Virtual Directory

Posted on 2005-03-08
5
Medium Priority
?
421 Views
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/

Thanks,
Nima
0
Comment
Question by:SWB-Consulting
[X]
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
5 Comments
 

Author Comment

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

Expert Comment

by:ahoffmann
ID: 13493548
use mod_rewrite:

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

Author Comment

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

Expert Comment

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

Accepted Solution

by:
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.

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

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