[pmwiki-users] lots of problems when redirecting or rewriting URLs
Joachim Durchholz
jo at durchholz.org
Tue Jan 17 02:30:21 CST 2006
Daniel Friedmann schrieb:
> 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
>
> How can I achieve this when my PmWiki is located in
> /var/www/spampal.de/htdocs/pmwiki?
>
> First of all, I only have very basic knowledge of Linux but have a
> dedicated Debian server for free (donated to the SpamPal project) so I
> can't ask my provider to help me for all the little Linux things I might
> need.
>
> I read http://www.pmwiki.org/wiki/Christian/RedirectURI and tried all
> three ideas with my paths but nothing worked.
>
> I also have access to the Apache httpd.conf but adding a line like
> Alias /pmwiki/ /var/www/spampal.de/htdocs/pmwiki
> or
> Alias /wiki "/var/www/spampal.de/htdocs/pmwiki/pmwiki.php"
> didn't work as well.
The syntax is
Alias desired-url-prefix filepath-prefix
One thing that *might* work is
Alias / /var/www/spampal.de/pmwiki.php
or
Alias / /var/www/spampal.de/pmwiki.php/
This should result in Apache turning
http://spampal.de/Main/Page
into
/var/www/spampal.de/pmwiki.php/Main/Page
You can check that by looking into these files:
/var/log/apache2/access_log
/var/log/apache2/error_log
To keep a continuous eye on the logs, log in using SSH or (if you have
it) the serial console and do
tail -f /var/log/apache2/access_log /var/log/apache2/error_log
so you can see what's the actual result.
The above Alias incantation should work if Apache does things in this way:
* URL-to-filename mapping
* Split off the end of the path until a filesystem object is found
* Find the type of the filesystem object, determine appropriate Action
("serve" for .html, "execute" for PHP, etc.)
* Put the split-off parts into the PATH_INFO environment variable
* Execute the action
If this works, you don't even need CleanUrls :-)
(CleanUrls is geared towards people who can't use Alias because they are
restricted to changing the .htaccess file - Alias is disallowed in
.htaccess.)
Hope that gets you started. Feel free to come back if Alias doesn't
work; in that case, we'll try CleanUrls anyway.
> What makes the ideas on http://www.pmwiki.org/wiki/Cookbook/CleanUrls
> very complicated are the comments in between. There are several comments
> for shorter and/or better alternatives but also some comments with
> drawbacks for them.
>
> I don't quite know what is the best working solution which is
> recommended.
The problem is that the best working solution depends on the way the
machine is set up. It's a big, big mess, and not going to be prettier
over time.
(Lighttpd might be an alternative; I've been seeing more and more
mentions in Google. I don't think an options for newbies struggling with
Debian at this time though: I'd expect Software like Webmin and
phpMyAdmin to interoperate better with Apache, Apache problems
nonwithstanding.)
> This is very frustrating because I really tried dozens of
> very similar and completely different solutions but haven't succeed so far.
That's normal. Looking in the error log isn't a very prominent advice,
so most newbies just see 404 or 500 errors and get no clue about what
exactly went wrong or where to look. (I've had the same experience
initially.)
I seriously recommend reading http://httpd.apache.org , particularly the
sections that deal with URL-to-filesystem mapping (DocumentRoot, Alias),
redirection (Redirect and relatives), rewriting (RewriteRule,
RewriteBase, RewriteLog), and .htaccess handling (AllowOverride).
Hope this all helps :-)
Regards,
Jo
More information about the pmwiki-users
mailing list