Welcome! Log In Create A New Profile

Advanced

Re: rewrite rules cms phpwcms not working

Francis Daly
February 16, 2015 03:38PM
On Sun, Feb 15, 2015 at 09:02:05AM -0500, dansch8888 wrote:

Hi there,

I've not tried to use phpwcms. But from the apache config and your
description, I think that the following provides some of the information
to the php interpreter that it wants.

> (track|include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)($|/)
> - [L]

I think that say "anything that matches that pattern should be served
as a plain file, and not given to the php interpreter". But there are
also .htaccess files in some of those directories.

So, after you are happy that the thing you want to be working is working
on your test system, add entries like

location ^~ /track/ {}
location ^~ /filearchive/ { deny all; }

to your server{} block, according to what you want, before you make it public.

> RewriteRule ^ index\.php$ - [L]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^
> ([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.html$
> /index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
> RewriteRule ^ (.+)\.html$ /index.php?$1&%{QUERY_STRING}
>
> Rewrite should do for example this:
> http://hometest.home.local/home_de.html ->
> http://hometest.home.local/index.php?home_de

I think that the above rewrites to http://hometest.home.local/index.php?home_de&

If the difference (the extra &) does not matter, then all is good.

At http level, add

map $request_uri $bit_of_qs {
default "";
~/(?P<name>.*)\.html $name;
}

Then at server level include

server {

if ($request_uri ~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\.(\d+)\.(\d+)\.html) {
set $bit_of_qs "id=$1,$2,$3,$4,$5,$6";
}

location / {
try_files $uri $uri/ @index.php;
}

location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location @index.php {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param QUERY_STRING $bit_of_qs&$query_string;
}

}


Depending on your fastcgi server, you may want the "include" line after
the "fastcgi_param" lines.

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

The above sets QUERY_STRING to what I think is the same thing that your
apache config sets it to.

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

I don't know if the above will let everything work -- I'd expect that
it would not -- but it should push you in the right direction.

(For example: it is not immediately clear to me what should happen to
a request for /a/1.2.3.4.5.6.html -- probably the above configuration
does not do what is wanted there.)

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite rules cms phpwcms not working

dansch8888 February 15, 2015 09:02AM

Re: rewrite rules cms phpwcms not working

Francis Daly February 16, 2015 03:38PM

Re: rewrite rules cms phpwcms not working

dansch8888 February 17, 2015 06:26PM

Re: rewrite rules cms phpwcms not working

Francis Daly February 18, 2015 04:26PM

Re: rewrite rules cms phpwcms not working

dansch8888 February 23, 2015 01:51PM

Re: rewrite rules cms phpwcms not working

Francis Daly February 24, 2015 03:40PM

Re: rewrite rules cms phpwcms not working

dansch8888 March 18, 2015 05:53PM

Re: rewrite rules cms phpwcms not working

dansch8888 March 19, 2015 05:03PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready