To use Permalinks with Saetta Web Server a properly configured URL rewriting module written in the C programming language is required.
Direct download link to the source code of the module.
Optionally edit the file wordpress.c
to change the default paths.
Search for the WORDPRESS_SHARED
define:
#define WORDPRESS_SHARED "/wordpress/"
Replace the path /wordpress/
with the path you use to access WordPress. For example, if you access WordPress from http://website.de/blog/wordpress/
you've to set WORDPRESS_SHARED
to "/blog/wordpress/"
. It's important for the value of this variable to begin and to end with a slash (“/”).
By default the URL rewriting module will automatically discover the right DOCUMENT_ROOT variable of the virtual directory matching the rewriting rule. You can improve a bit the performance of the URL rewriting module by defining the VDIR_DOCUMENT_ROOT
variable manually:
// This variable doesn't want a slash at the end of its value.
#define VDIR_DOCUMENT_ROOT "/var/www"
Full example:
http://website.de/blog/wordpress/
/var/www/blog/wordpress/
<directory www="/" root="/var/www" >
Then you've to set:
#define WORDPRESS_SHARED "/blog/wordpress/"
#define VDIR_DOCUMENT_ROOT "/var/www"
(concatenating VDIR_DOCUMENT_ROOT
and WORDPRESS_SHARED
results in the full server path to the files)
Build the module using the GNU C compiler:
gcc -Wall -shared -O3 -s -fPIC -pthread -o wordpress.so wordpress.c
Upload the module to the server if compiled off site, and then add it to the XML configuration file of your server:
<websites>
<website host=":80">
<urlrewriters>
<urlrewriter enabled="1" path="/var/www/private/wordpress.so" entrypoint="saetta_main" />
</urlrewriters>
....
</website>
</websites>
Set as path the full path to the compiled module.
Start or restart the web server.
Open the wp-includes/vars.php file. Look for:
$is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false ...);
and replace that line with:
$is_apache = true;
Open the wp-includes/load.php file. And, in the function function wp_fix_server_vars()
, insert after
$_SERVER = array_merge( $default_server_values, $_SERVER );
this code:
if(php_sapi_name() == 'saetta' && isset($_GET['X-ORIGINAL-URL']))
$_SERVER['REQUEST_URI'] = $_GET['X-ORIGINAL-URL'];
Configure WordPress from the WordPress Admin panel to use the Permalinks you prefers.