rewrite rules cms phpwcms not working

dansch8888 nginx-forum at
Sun Feb 15 14:02:05 UTC 2015

I try to convert apache rewrite rules for CMS phpwcms (, but
with the online converter tools and some adjustments recommended at the
nginx wiki I still struggle with that.

That's my configuration
Debian Whezzy
nginx v 1.6.2
php5-fpm 5.5.20-1~dotdeb.1 (fpm-fcgi)

**Rewrite Rule Apache**
RewriteEngine on
RewriteBase /
RewriteRule ^
- [L]
RewriteRule ^ index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^
RewriteRule ^ (.+)\.html$ /index.php?$1&%{QUERY_STRING}

Rewrite should do for example this:
http://hometest.home.local/home_de.html ->

CMS without rewrite works fine.

Tests with the converted rewrite rules where not working and more confused
then rewriting with the try_files option.
So I switched to test with try_files. Examples for wordpress or drupal where
not working too.

Now I'm at this stage. I believe the main problem is the "QUERY_STRING", but
I have no idea how that get rendered.

**Nginx Site Config /etc/nginx/sites-available/default :**
listen 80 default_server;
server_name hometest.home.local;
root /data/www/vhosts/default/public_html;
location / {
   try_files $uri /index.php;
location ~ \.php$ {
	fastcgi_pass unix:/var/run/php5-fpm.sock;
	fastcgi_index index.php;
	include fastcgi_params;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
rewrite_log on;
access_log /data/www/vhosts/default/logs/access.log;
error_log /data/www/vhosts/default/logs/error.log debug;

That's what the logfile shows.

**Nginx Error Log:**
[debug] 6102#0: *1 http run request: "/index.php?"
[debug] 6102#0: *1 http upstream check client, write event:1, "/index.php"
[debug] 6102#0: *1 http upstream recv(): -1 (11: Resource temporarily
[error] 6102#0: *1 FastCGI sent in stderr: "PHP message: PHP Notice:  Use of
undefined constant Y - assumed 'Y' in
: eval()'d code on line 1

function include_int_phpcode($string) {
	// return the PHP code
	$s = html_despecialchars($string[1]);
	$s = str_replace('<br>', "\n", $s);
	$s = str_replace('<br />', "\n", $s);
	return ob_get_clean();

I hope someone can help me with this. The phpcwms forum couldn't give me an
answer so fare.

Thank you

Posted at Nginx Forum:,256693,256693#msg-256693

More information about the nginx mailing list