01000: ?action=crypt fails with CleanUrls enabled

Summary: ?action=crypt fails with CleanUrls enabled
Created: 2008-01-05 16:17
Status: Closed
Category: Bug
From: JL
Priority: 4
Version: 2.2.0-beta65
OS: Linux / Apache2 / PHP Version 5.2.5

Description: ?action=crypt fails with CleanUrls enabled. There is a '/' missing in crypt.php .

<form action='{\$ScriptUrl}' method='POST'> must be changed to <form action='{\$ScriptUrl}/' method='POST'>

This already was an issue some time ago. http://www.pmichaud.com/pipermail/pmwiki-users/2004-December/008722.html

Version 2.0.beta14 (28-Dec-2004) should have fixed this bug but it is still there.

Changing it as suggested may break the form on sites with CleanUrls/PathInfo disabled. Also, I couldn't reproduce this bug. PmWiki.org uses CleanUrls and the ?action=crypt form works. On my CleanUrls site it works too. Maybe you need a fix with your $ScriptUrl variable? (I'll try to help out if you give more details.) --Petko May 07, 2009, at 08:56 PM

Sometimes there seems to be some kind of magic. It seems to work like it should on my linux server and on my host server. I close this bug. JL May 09, 2009

I had the exact same problem. After some experimentation I found a likely solution. The problem lies in a combination of the configuration required for CleanUrl and what's in the .htaccess file. This is also assuming you have an index.php wrapper set up from the install instructions. First of all, if you have $ScriptUrl set to "http://www.example.com/wiki" and put in the default configuration for .htaccess, it will fail because mod_rewrite is sending everything to pmwiki.php still. I.E., the default instructions are assuming you're not using an index.php wrapper. During the course of this, the request ?action=crypt gets lost when you submit the form. The fix is to make your .htaccess file look like this instead

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
RewriteEngine On
# Define the rewrite base.
RewriteBase /wiki
# Send requests without parameters to index.php.
RewriteRule ^$ index.php  [L]
# Send requests to pmwiki.php, appending the query string part.
RewriteRule ^([A-Z0-9\xa0-\xff].*)$ index.php?n=$1  [QSA,L]

This will ensure that all requests go to the index.php file, which will, on its own, send all requests to pmwiki.php, thus preserving all your clean urls akin to http://www.example.com/wiki/Main/WelcomePage.
--Sergeant (October 9, 2009)

this rewrite solution still isn't working, with getting 301 Moved Permanently answer to POST query
Solved this by setting this in config: $_GET["action"]==="crypt"?$ScriptUrl = 'https://site/wiki/':$ScriptUrl = 'https://site/wiki';
-- BlacK? June 01, 2018, at 08:45 PM