Not logged in. · Lost password · Register
Forum: General Help and Support Server Setup RSS
Redirect to index.php with apache2/ubuntu
Avatar
alazyworkaholic #1
Member since Jun 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Redirect to index.php with apache2/ubuntu
I have an ubuntu/apache host.
I installed dokuwiki manually at /var/www/alazysite/dokuwiki.
I want my dokuwiki instance to be easily accessible as a part of a personal website that will host other services through a single port (tired of trying to remember which port maps to what service on my home server) so I am trying to configure it within a directory.

My server is working and so is dokuwiki, except I cannot get an automatic redirect from my.host/dokuwiki to my.host/dokuwiki/index.php
That's all I want. The rest is my troubleshooting attempt.

Here's the vhost file from /etc/apache2/sites-available/alazysite:
VirtualHost *:8765>

    ServerName alazyApache
    DocumentRoot /var/www/alazysite
    DirectoryIndex index.php index.html

    <Directory /var/www/alazysite/dokuwiki/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
        ReWriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*) index.php [PT,L]
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

If I copy this to a new vhost file and change only the DocumentRoot to /var/www/alazysite/dokuwiki/ (and the port), redirection works as expected.
The apache error log shows this:
[...date, pid client...] script '/var/www/alazysite/index.php' not found or unable to stat
While the browser shows this:
Not Found

The requested URL /index.php was not found on this server.
Apache/2.4.38 (Ubuntu) Server at 192.168.1.69 Port 8765

If I put an index.php file at /var/www/alazysite/index.php the errors disappear and it serves that index.php. However, I want it to serve the index.php at /var/www/alazysite/dokuwiki/index.php (which forwards to doku.php, I don't know how) instead, and I want to get that by just typing my.host/dokuwiki

How can I accomplish that?

Thanks!
Avatar
alazyworkaholic #2
Member since Jun 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post
After puzzling over this for hours and taking the time to write a forum post, I immediately have an insight and it works.
I needed to change the line in my vhost file from
RewriteRule ^(.*) index.php [PT,L]
to
RewriteRule ^(.dokuwiki/*) index.php [PT,L]
Solved.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-10-17, 10:27:39 (UTC +02:00)