Mailing List Archive

help; getting wiki url rewriting right
I followed the instructions in the INSTALL file, and got Wikipedia up
and running.

However, the URL rewriting, cut and pasted from the INSTALL file,
doesn't seem to work at all. This seems to work:

http://reactor-core.org/t/wiki.phtml?title=Main_Page

But this does NOT:

http://reactor-core.org/t/wiki/Main_Page

Any ideas what I am doing wrong?

Here is the relevant section of my httpd.conf:

=== SNIP ===
<Directory /usr/home/djw/src/wikipedia/phpwiki/newcodebase>
php_admin_flag engine on
</Directory>
<VirtualHost ...>
...
Alias /t /usr/home/djw/src/wikipedia/phpwiki/newcodebase/
RewriteEngine On
RewriteRule ^/t/wiki/wiki.phtml(.*) /t/wiki.phtml$1
RewriteRule ^/t/wiki/(.*)$ /t/wiki.phtml?title=$1
RewriteRule ^/movie/(.*) http://us.imdb.com/Title?$1 [R]
RewriteRule ^/isbn/(.*) http://www.amazon.com/exec/obidos/ASIN/$1 [R]
...
</VirtualHost>
=== SNIP ===

Also, I would like to make the direct wiki.phtml URL unaccessable; I
want to force people to use the /t/wiki/* style URL, and not give out
any access at all to the /t/wiki.phtml?* URL's. Ideas?

Jonathan

--
Geek House Productions, Ltd.

Providing Unix & Internet Contracting and Consulting,
QA Testing, Technical Documentation, Systems Design & Implementation,
General Programming, E-commerce, Web & Mail Services since 1998

Phone: 604-435-1205
Email: djw@reactor-core.org
Webpage: http://reactor-core.org
Address: 2459 E 41st Ave, Vancouver, BC V5R2W2
Re: help; getting wiki url rewriting right [ In reply to ]
On Tue, 2002-12-17 at 08:50, Jonathan Walther wrote:
> However, the URL rewriting, cut and pasted from the INSTALL file,
> doesn't seem to work at all. This seems to work:
...
> Any ideas what I am doing wrong?

Hmm, do 'Alias' and mod_rewrite interact well?

> Alias /t /usr/home/djw/src/wikipedia/phpwiki/newcodebase/
> RewriteEngine On
> RewriteRule ^/t/wiki/wiki.phtml(.*) /t/wiki.phtml$1
> RewriteRule ^/t/wiki/(.*)$ /t/wiki.phtml?title=$1
> RewriteRule ^/movie/(.*) http://us.imdb.com/Title?$1 [R]
> RewriteRule ^/isbn/(.*) http://www.amazon.com/exec/obidos/ASIN/$1 [R]

For reference, here's the entry for test.wikipedia.org:

<VirtualHost 130.94.122.197>
DocumentRoot "/usr/local/apache/htdocs-test"
ServerName test.wikipedia.org
ErrorLog logs/test.wikipedia.org-error_log
CustomLog logs/test.wikipedia.org-log combined

RewriteEngine On
RewriteMap ampescape int:ampescape
RewriteRule ^/wiki/(.*)$ /w/wiki.phtml?title=${ampescape:$1} [L]
RewriteRule ^/w/wiki.phtml(.*) /w/wiki.phtml$1
RewriteRule ^/wiki$ /w/wiki.phtml
RewriteRule ^/$ /w/wiki.phtml
</VirtualHost>

('ampescape' is a custom conversion function to turn an ampersand & to
%26 so that titles with ampersands don't get screwed over, since the
built-in 'urlescape' doesn't fix them. Patch for Apache 1.3.26+:
http://www.wikipedia.org/tools/ampersand.diff )

> Also, I would like to make the direct wiki.phtml URL unaccessable; I
> want to force people to use the /t/wiki/* style URL, and not give out
> any access at all to the /t/wiki.phtml?* URL's. Ideas?

Stick a [QSA] on the rewrite rule to append instead of replace the query
string, see if that goes in the right direction.

-- brion vibber (brion @ pobox.com)