putting stupid search engine urls back

AMP Admin admin at ampprod.com
Sun Aug 30 18:25:29 MSD 2009

I think something's missing from that so I've tried the following but no
luck.  Thoughts?

location ~ ^.*-t([0-9]+).html$ {
	fastcgi_index			index.php;
	include				fastcgi_params;
	fastcgi_intercept_errors	On;
	fastcgi_ignore_client_abort	On;
	fastcgi_buffer_size   		128k;
	fastcgi_buffers       		4 128k;	
	rewrite ~ ^.*-t([0-9]+).html$ /path/to/stuff/showthread.php?t=$1

-----Original Message-----
From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of
Marcus Clyne
Sent: Sunday, August 30, 2009 12:58 AM
To: nginx at sysoev.ru
Subject: Re: putting stupid search engine urls back

AMP Admin wrote:
> Well, I coulndn't get that to work.  I'm not too good with regex stuff.
> Anyone wanna give me an assist on the following?
> I need 
> http://www.example.com/anyone-doing-late-ridei-t19640.html
> to go to
> http://www.example.com/showthread.php?t=19640
server {
    server   example.com;

    location ~ ^.*-t([0-9]+).html$ {
       fastcgi_pass   ...;
       fastcgi_param SCRIPT_FILENAME  

Is one possibility.

If the document root changes, then you might want to use the 
$document_root variable like:

fastcgi_param SCRIPT_FILENAME  $document_root/showthread.php?t=$1;

but if you can put it in statically, it'll be slightly better 

Note, the above regex assumes that all the articles have 
-t[thread_number] at the end.


More information about the nginx mailing list