Trivial question, map virtual directory?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Trivial question, map virtual directory?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Trivial question, map virtual directory?  
Casper Bang


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 12:25 PM

Let's say I want to map a directory not in my document server root (i.e.
/var/wiki) to mysite.com/wiki, how could I do this without having to
physically move /var/wiki to /var/www/wiki/ ?

Thanks in advance,
Casper





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Casper Bang


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 06:20 PM

I forgot to mention, that the problem is with certain rewrite rules. I
have installed dekiwiki under the DocumentRoot as the documentation
mentions:

-----------------------------------------------------------8<
<VirtualHost *>
ServerName mywiki.example.com
ServerAdmin webmaster@mywiki.example.com
(mailto:webmaster@mywiki.example.com)

ErrorLog /var/log/apache2/mywiki.example.com-error_log
CustomLog /var/log/apache2/mywiki.example.com-access_log common

DocumentRoot /var/www/mywiki.example.com/

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/$ /index.php?title=Home [L,NE]

RewriteCond %{REQUEST_URI}
!/ (attachments|ControlPanel|editor|stylesh
eets|images|skins)/
RewriteCond %{REQUEST_URI} !/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !/favicon.ico
RewriteCond %{REQUEST_URI} !/robots.txt
RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:S
earch
RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]
</VirtualHost>
-----------------------------------------------------------8<

...but when using simple Apache Location ddirectives, mapping to a
virtual directory instead of the DocumentRoot, the wiki does not work:

-----------------------------------------------------------8<
Alias /wiki/ "/var/www/mywiki/"

<Location /wiki>

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/$ /index.php?title=Home [L,NE]

RewriteCond %{REQUEST_URI}
!/ (attachments|ControlPanel|editor|stylesh
eets|i$
RewriteCond %{REQUEST_URI} !/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !/favicon.ico
RewriteCond %{REQUEST_URI} !/robots.txt
RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:S
earch
RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]

</Location>
-----------------------------------------------------------8<

...I guess it has something to do with me missing a directive or having
to modify a rewrite rule, but I have been unable to make it work thus far.

Please help,
Casper





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Davide Bianchi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 06:20 PM

On 2007-01-28, Casper Bang <casper@jbr.dk> wrote:
> Let's say I want to map a directory not in my document server root (i.e.
> /var/wiki) to mysite.com/wiki, how could I do this without having to
> physically move /var/wiki to /var/www/wiki/ ?

Use an Alias:

Alias /wiki/ /var/wiki/
<Directory "/var/wiki">
..directives as required...
</Directory>

As long as the permissions on /var and /var/wiki are ok, it will work.

Davide

--
"You are trapped in a maze of screens and ssh sessions all alike."
"It is dark, and you are likely to log off the wrong account."
-- from alt.sysadmin.recovery





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Davide Bianchi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 06:20 PM

On 2007-01-28, Casper Bang <casper@jbr.dk> wrote:
> Alias /wiki/ "/var/www/mywiki/"
>
><Location /wiki>

Change this into a <Directory "/var/www/mywiki"> and you should be ok.

D.

--
You're a brave man. Go and break through the lines. And remember,
while you're out there risking your life and limb through shot and
shell, we'll be in here thinking what a sucker you are.
-- Julius Henry "Groucho" Marx (http://en.wikiquote.org/wiki/Groucho_Marx)





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Casper Bang


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 06:20 PM

Thanks Davide,

...but when I access my SERVER_ROOT/wiki/ site I am instantly redirected
to SERVER_ROOT/Home.
I suspect I have to update the redirect scripts somehow?

Thanks,
Casper





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Davide Bianchi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-07 12:23 AM

On 2007-01-28, Casper Bang <casper@jbr.dk> wrote:
> ...but when I access my SERVER_ROOT/wiki/ site I am instantly redirected
> to SERVER_ROOT/Home.

? What do you mean by "access SERVER_ROOT" ? You shouldn't access
the 'server root' at all, if you have setup an alias /something/, then
THAT is what you should request (/something) without anything else.

Davide

--
This is an air conditioned room -- do not open Windows!





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Casper Bang


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-07 12:23 AM

I mean, when I request mysite.com/wiki/, a redirect rule (required by
the software, DekiWiki) directed me down to the DocumentRoot (mysite.com).

The rewrite example for hosting the wiki at the DocumentRoot states the
following rewrite requirements:

1    RewriteEngine on
2    RewriteCond %{REQUEST_URI} ^/$
3    RewriteRule ^/$ /index.php?title=Home [L,NE]
4    RewriteCond %{REQUEST_URI} !/(attachments||stylesheets|i$
5    RewriteCond %{REQUEST_URI} !/(redirect|texvc|index).php
6    RewriteCond %{REQUEST_URI} !/error/(40(1|3|4)|500).html
7    RewriteCond %{REQUEST_URI} !/favicon.ico
8    RewriteCond %{REQUEST_URI} !/robots.txt
9    RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Spec
ial:Search
10   RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]

...I have tried adding /wiki/ to various places, line 3 and 10 but I am
still thrown to the DocumentRoot rather than DocumentRoot/wiki/

Can anyone experienced with Rewrite clauses let me know exactly which
lines to modify?

Thanks,
Casper





[ Post a follow-up to this message ]



    Re: Trivial question, map virtual directory?  
Davide Bianchi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-07 12:22 PM

On 2007-01-28, Casper Bang <casper@jbr.dk> wrote:
> I mean, when I request mysite.com/wiki/, a redirect rule (required by
> the software, DekiWiki) directed me down to the DocumentRoot (mysite.com).

So the '/wiki/' bit is removed?

> 10   RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]

This is the one: it replace eveything with the /index.php bit, you should
add /wiki/ to the second part of the rewrite. What does the documentation
for that application says about it?

Davide

--
General Protection Fault!  [ Ignore ]  [ Reboot ]  [ Install Lin
ux ]
-- From a Slashdot.org post





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:18 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register