Mailing List Archive

configuration and mod_rewrite
I run on Redhat 9.0 with Apache 2.x, PHP 4.2.2 (old I know).

The problem is with the sample LocalSettings.sample (cp to LocalSettings.php) I
believe. I have the following in my LocalSettings.php file:

$wgSitename = "Synergypedia";
$wgMetaNamespace = FALSE; # will be same as you set $wgSitename

$wgServer = "http://sledge";
$wgScriptPath = "/synergypedia";
$wgArticlePath = "{$wgScript}?title=$1";
$wgEmergencyContact = "tsanders@synergymicro.com";

However, when I access some of the links on the Main Page (via
http://sledge/synergypedia/wiki.phtml), the links contain /wiki instead of
/synergypedia. I seems that the php vars in DefaultSettings.php are not getting
set appropriately based on the settings in the LocalSettings.phph file. Do I
need to copy the entire block of corresponding links from the
DefaultSettings.php file to override all of them? I don't know the variable
substituion rules for php. If I copy the block of vars it works.

$wgSitename = "Synergypedia";
$wgMetaNamespace = FALSE; # will be same as you set $wgSitename

#$wgServer = "http://sledge" . getenv( "SERVER_NAME" );
$wgServer = "http://sledge";
$wgScriptPath = "/synergypedia";
$wgScript = "{$wgScriptPath}/wiki.phtml";
$wgRedirectScript = "{$wgScriptPath}/redirect.phtml";
$wgStyleSheetPath = "{$wgScriptPath}/style";
$wgStyleSheetDirectory = "{$IP}/style";
$wgArticlePath = "{$wgScript}?title=$1";
$wgUploadPath = "{$wgScriptPath}/upload";
$wgUploadDirector = "{$IP}/upload";
$wgLogo = "{$wgUploadPath}/jungle.png";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
$wgPasswordSender = "Wikipedia Mail <tsanders@synergymicro.com>";
#$wgPasswordSender = "Wikipedia Mail
<apache@www.wikipedia.org>\r\nReply-To: webmaster@www.wikipedia.org";
$wgEmergencyContact = "tsanders@synergymicro.com";


Next I am trying to use the RewriteRule in Apache. I have the following:

RewriteEngine On
RewriteRule ^/synergypedia/(.*)$ /synergypedia/wiki.phtml?title=$1 [L]

So if I access http://sledge/synergypedia/Main_Page I get the Main Page, or
http://sledge/synergypedia/New_Page I get the New Page (with the text that no
content is present for the page). In any case all of the links on the pages
(i.e. 'Edit this page') look like the following
http://sledge/synergypedia/wiki.phtml?title=Main_Page&action=edit. Seems ok but
when I click it I get

Wiki.phtml
From Synergypedia, the free encyclopedia.

(There is currently no text in this page)

Thus it is trying to find a page titled wiki.phtml.

How do I get it to not try to create a page for wiki.phtml?



--
====================================================
Tim M. Sanders tsanders@synergymicro.com
Synergy Microsystems Phone: 520.690.1709 x323
3895 N Business Center Dr. Fax: 520.690.1796
Suite 100
Tucson, AZ 85705-6906
Re: configuration and mod_rewrite [ In reply to ]
On Dec 4, 2003, at 14:00, Tim M. Sanders wrote:
> Do I
> need to copy the entire block of corresponding links from the
> DefaultSettings.php file to override all of them? I don't know the
> variable
> substituion rules for php. If I copy the block of vars it works.

A string interpolation (variable reference inside a string literal) is
evaluated at the time the string is evaluated. So, if you set the
variable _after_ it's used, it's too late. You now need to set it
again.

> RewriteEngine On
> RewriteRule ^/synergypedia/(.*)$ /synergypedia/wiki.phtml?title=$1 [L]

I'd recommend keeping wiki.phtml and the other 'real files' separate
from the virtual rewritten "directory" for the wiki pages. For instance
on Wikipedia we have /wiki/ for the wiki pages and /w/ for the scripts
and /style/ for the stylesheets, etc. So nothing gets too confused.

-- brion vibber (brion @ pobox.com)