[pmwiki-users] lots of problems when redirecting or rewriting URLs

H. Fox haganfox at users.sourceforge.net
Sun Jan 15 13:26:08 CST 2006


On 1/15/06, Daniel Friedmann <list at linuxing.de> wrote:
> Hello
>
> I'm trying to shorten the URLs:
>
> from
> http://spampal.de/pmwiki/pmwiki.php/Main/HomePage
>
> to
> http://spampal.de/pmwiki/Main/HomePage
>
> or even better to
> http://spampal.de/Main/HomePage
[...]
> I don't quite know what is the best working solution which is
> recommended. This is very frustrating because I really tried dozens of
> very similar and completely different solutions but haven't succeed so far.

Here's what I use at http://qdig.sourceforge.net/ .  (Yes, it goes
against some of the advice on the CleanUrls page.)

.htaccess (three lines):

   RewriteEngine on
   RewriteBase /
   RewriteRule ^([A-Z].*)
/home/groups/q/qd/qdig/htdocs/index.php?pagename=$1 [L,qsappend]

index.php:

   <?php
   chdir('site');
   include('pmwiki.php');

site/local/config.php (excerpt)

   $EnablePathInfo = 1;
   $ScriptUrl = 'http://qdig.sourceforge.net';
   $PubDirUrl = 'http://qdig.sourceforge.net/site/pub';

You may need to define some other directory locations such as
$UploadDir and $UploadUrlFmt.

...

I just tested on an internal server (shebang.example.com) and it works
well there.  Here are the files for that installation:

/var/www/.htaccess

   RewriteEngine on
   RewriteBase /
   RewriteRule ^([A-Z].*) /var/www/index.php?pagename=$1 [L,qsappend]

/var/www/index.php

   <?php
   chdir('site');
   include('pmwiki.php');

/var/www/site/local/config.php (excerpt)

   $EnablePathInfo = 1;
   $ScriptUrl = 'http://shebang.example.com';
   $PubDirUrl = 'http://shebang.example.com/site/pub';

/etc/apache/httpd.conf (excerpt, to enable .htaccess)

   <Directory /var/www/>
       AllowOverride FileInfo AuthConfig Limit
   </Directory>

/var/www/site is just a symbolic link to /home/someuser/public_html/pmwiki .

Hagan




More information about the pmwiki-users mailing list