[pmwiki-users] CleanUrls

Maria McKinley mariak at mariakathryn.net
Wed Feb 20 13:23:50 CST 2013


On Wed, Feb 20, 2013 at 10:55 AM, Petko Yotov <5ko at 5ko.fr> wrote:

> Maria McKinley writes:
>
>> Is there a way to not have "pmwiki" show up in the url if you have
>> .htaccess and pmwiki.php in the same directory? I'm thinking not, but
>> wanted to verify.
>>
>
> Yes. Normally you have an index.php file which includes pmwiki.php
> (wherever pmwiki.php is, in the same directory or elsewhere) and use URL
> rewriting to redirect requests to index.php.
>
> Here is a sample .htaccess which I use on many different sites:
>
>  RewriteEngine On
>  RewriteBase /
>  RewriteCond %{REQUEST_FILENAME} !-f
>  RewriteCond %{REQUEST_FILENAME} !-d
>  RewriteCond %{REQUEST_FILENAME} !-l
>  RewriteRule ^([A-Z0-9\x80-\xFF].*)$       /index.php?n=$1  [QSA,L]
>
> The RewriteCond lines limit the redirection only if the requested URL
> isn't an actual filename or directory.
>
> The above .htaccess and index.php are in the DOCUMENT_ROOT directory of
> the server, and in the same directory are wiki.d/ and uploads/.
>
> If your index.php file, wiki.d/ and uploads/ are in a subdirectory, for
> example pmwiki/index.php, and you want your URLs to be like
>
>  www.shadlenlab.columbia.edu/**Main/HomePage<http://www.shadlenlab.columbia.edu/Main/HomePage>
>
> then you need to edit the .htaccess file in the root directory, not the
> one in the pmwiki/ subdirectory. Here is an example of such a working file:
>
>  RewriteEngine On
>  RewriteBase /
>  RewriteRule ^$       /pmwiki/index.php [QSA,L]
>  RewriteCond %{REQUEST_FILENAME} !-f
>  RewriteCond %{REQUEST_FILENAME} !-d
>  RewriteCond %{REQUEST_FILENAME} !-l
>  RewriteRule ^([A-Z0-9\x80-\xFF].*)$       /pmwiki/index.php?n=$1  [QSA,L]
>
> The first RewriteRule line redirects www.shadlenlab.columbia.edu/ without
> anything else to PmWiki, the last redirects anything that is not a file/dir
> also to PmWiki.
>
> The /pmwiki/index.php file includes pmwiki.php (wherever it may be) and
> sets the $ScriptUrl variable and if needed, the $PubDirUrl, the
> $FarmPubDirUrl and the $UploadsUrlFmt variables.
>
> The first example works for me with HTTPS off, the second with HTTPS on,
> without doing anything in particular.
>
>
>  In a related question, any idea why this if statement would not work?
>> # Set PmWiki paths according to the SSL mode
>> if ($UrlScheme == 'https') {
>>   $ScriptUrl = "https://www.shadlenlab.**columbia.edu/pmwiki<https://www.shadlenlab.columbia.edu/pmwiki>
>> ";
>>  }
>> else {
>>   $ScriptUrl = "http://www.shadlenlab.**columbia.edu<http://www.shadlenlab.columbia.edu>
>> ";
>>  }
>>
>> I always end up with the pmwiki in the url, regardless of whether I am
>> using https or http.
>>
>
> I don't see why, it is possible that some of the $_SERVER variables of the
> system are not correctly presented to PmWiki.
>
> Petko
>
>
So,  the reason I was doing this is because I was having problems with the
path when I switched from http to https and back again. I tried using a
different recipe on the
http://www.pmwiki.org/wiki/Cookbook/SwitchToSSLModepage (the one
towards the bottom by jtankers), and this solved my path
problems, so I didn't end up having to do either of the above. In my
htaccess in the root directory (above pmwiki), I set the RewriteCond for
HTTPS_HOST, but it seems to work for both http and https now. Weird. My php
skills are not great enough to see all the differences between the methods
proposed for switching to SSL mode, but the one by jtankers is the only one
I could get to use the correct paths, regardless of whether it was in http
or https mode.

thanks everyone. I have another question regarding logging in using ssl,
but that should be moved to a different thread...

Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130220/24e65944/attachment.html>


More information about the pmwiki-users mailing list