[pmwiki-users] ** Final Solution: Re: lots of problems when redirecting or rewriting URLs
DaveG
pmwiki at solidgone.com
Thu Jan 19 19:31:39 CST 2006
Okay. I've now got everything working. Here's the final solution,
*Definitions*
Root/top level directory: The base of the url you want users to see. If
you want: "http://xxx.com/Main/HomePage" the this would be "/"; if you
want "http://xxx.com/pmwiki/Main/HomePage" it would be "/pmwiki/".
*Assumptions*
1] We want URL's in the format:
"http://xxx.com/~nepherim/Main/HomePage",
2] top/root directory is "/~nepherim/". Root is where your main
index.php file will reside (not necessarily the same as where pmwiki.php
resides).
3] pmwiki is installed in "/~nepherim/pmwiki". *NOTE:* if pmwiki is in a
different directory to the top/root then there does not need to be an
index.php or .htaccess in the pmwiki directory -- they will be placed in
the top/root.
*Process*
1] In the root/top level directory .htaccess:
Options +FollowSymLinks
RewriteEngine on
#Path to the root/top level directory:
RewriteBase /~nepherim/
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/?$ Main/HomePage/ [R=permanent,QSA,L]
#index.php resides in the root/top level directory
RewriteRule ^([^/a-z].*) index.php?n=$1 [QSA,L]
2] Create an index.php in the root/top level directory, which the rules
above are redirecting to:
<?
php chdir('pmwiki');
include 'pmwiki.php';
3] In pmwiki/local/config.php (note, the lack of trailing "/" except for
"$UploadDir":
$EnablePathInfo = 1;
$BaseUrl = 'http://'.$_SERVER[HTTP_HOST].'/~nepherim/pmwiki';
$ScriptUrl = 'http://'.$_SERVER[HTTP_HOST].'/~nepherim';
$PubDirUrl = $BaseUrl.'/pub';
$UploadUrlFmt = $BaseUrl.'/uploads';
$UploadDir = 'uploads/';
4] Make sure your .tmpl template image files have the appropriate path.
Good luck!
~ ~ Dave
Waylan Limberg wrote:
> On 1/19/06, DaveG <pmwiki at solidgone.com> wrote:
>> The whole thing is pretty clear to me now! Based on the idea of moving
>> .htaccess up to the root directory, I've now managed to get URL's:
>> From: http://dom.com/~nepherim/pmwiki/Home/HomePage/
>> To: http://dom.com/~nepherim/Main/HomePage
>>
>> I'm having a problem (URL not found) with Editing, Uploading, and
>> History links (strangely Searching works fine).
>>
>> I used this .htaccess inside "http://dom.com/~nepherim/":
>> Options +FollowSymLinks
>> RewriteEngine on
>> RewriteBase /~nepherim/
>> RewriteCond %{QUERY_STRING} ^$
>> RewriteRule ^([^/a-z].*) index.php?n=$1 [QSA,L]
>>
>> I put an index.php inside "http://dom.com/~nepherim/":
>> <?php chdir('pmwiki'); include 'pmwiki.php';
>>
>> And I used these settings in config.php:
>> $BaseUrl = 'http://'.$_SERVER[HTTP_HOST].'/~nepherim';
>> $ScriptUrl = $BaseUrl;
>> $PubDirUrl = $BaseUrl.'/pmwiki/pub';
>> $ImgDirUrl = $ScriptUrl.'/pmwiki/img';
>> $UploadUrlFmt = $BaseUrl.'/pmwiki/uploads';
>>
>>
>> ~ ~ Dave
>>
> I see you got it. That is what I was trying to suggest. Sorry I wasn't clear.
Not at all, thanks for putting the thought in my head!
>
>
>
> --
> ----
> Waylan Limberg
> waylan at gmail.com
>
More information about the pmwiki-users
mailing list