On Wed, Feb 20, 2013 at 10:55 AM, Petko Yotov <span dir="ltr"><<a href="mailto:5ko@5ko.fr" target="_blank">5ko@5ko.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Maria McKinley writes:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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. <br>
</blockquote>
<br></div>
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.<br>
<br>
Here is a sample .htaccess which I use on many different sites:<br>
<br>
 RewriteEngine On<br>
 RewriteBase /<br>
 RewriteCond %{REQUEST_FILENAME} !-f<br>
 RewriteCond %{REQUEST_FILENAME} !-d<br>
 RewriteCond %{REQUEST_FILENAME} !-l<br>
 RewriteRule ^([A-Z0-9\x80-\xFF].*)$       /index.php?n=$1  [QSA,L]<br>
<br>
The RewriteCond lines limit the redirection only if the requested URL isn't an actual filename or directory.<br>
<br>
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/.<br>
<br>
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<br>
<br>
 <a href="http://www.shadlenlab.columbia.edu/Main/HomePage" target="_blank">www.shadlenlab.columbia.edu/<u></u>Main/HomePage</a><br>
<br>
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:<br>
<br>
 RewriteEngine On<br>
 RewriteBase /<br>
 RewriteRule ^$       /pmwiki/index.php [QSA,L]<br>
 RewriteCond %{REQUEST_FILENAME} !-f<br>
 RewriteCond %{REQUEST_FILENAME} !-d<br>
 RewriteCond %{REQUEST_FILENAME} !-l<br>
 RewriteRule ^([A-Z0-9\x80-\xFF].*)$       /pmwiki/index.php?n=$1  [QSA,L]<br>
<br>
The first RewriteRule line redirects <a href="http://www.shadlenlab.columbia.edu/" target="_blank">www.shadlenlab.columbia.edu/</a> without anything else to PmWiki, the last redirects anything that is not a file/dir also to PmWiki.<br>

<br>
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.<br>
<br>
The first example works for me with HTTPS off, the second with HTTPS on, without doing anything in particular.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In a related question, any idea why this if statement would not work?<br>
# Set PmWiki paths according to the SSL mode<br>
if ($UrlScheme == 'https') {<br>
  $ScriptUrl = "<a href="https://www.shadlenlab.columbia.edu/pmwiki" target="_blank">https://www.shadlenlab.<u></u>columbia.edu/pmwiki</a>";<br>
 }<br>
else {<br>
  $ScriptUrl = "<a href="http://www.shadlenlab.columbia.edu" target="_blank">http://www.shadlenlab.<u></u>columbia.edu</a>";<br>
 }<br>
<br>
I always end up with the pmwiki in the url, regardless of whether I am using https or http.<br>
</blockquote>
<br></div>
I don't see why, it is possible that some of the $_SERVER variables of the system are not correctly presented to PmWiki.<span class="HOEnZb"><font color="#888888"><br>
<br>
Petko</font></span><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div> </div><div>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 <a href="http://www.pmwiki.org/wiki/Cookbook/SwitchToSSLMode">http://www.pmwiki.org/wiki/Cookbook/SwitchToSSLMode</a> page (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.</div>
<div><br></div><div>thanks everyone. I have another question regarding logging in using ssl, but that should be moved to a different thread...</div><div><br></div><div>Maria</div></div>