|
Home > Archive > Apache Server configuration support > January 2007 > Trivial question, map virtual directory?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Trivial question, map virtual directory?
|
|
| Casper Bang 2007-01-28, 7:25 am |
| 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
| |
| Casper Bang 2007-01-28, 1: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:Search
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:Search
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
| |
| Davide Bianchi 2007-01-28, 1: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
| |
| Davide Bianchi 2007-01-28, 1: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)
| |
| Casper Bang 2007-01-28, 1: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
| |
| Davide Bianchi 2007-01-28, 7:23 pm |
| 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!
| |
| Casper Bang 2007-01-28, 7:23 pm |
| 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} ^/Special: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
| |
| Davide Bianchi 2007-01-29, 7:22 am |
| 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 Linux ]
-- From a Slashdot.org post
|
|
|
|
|