putting stupid search engine urls back

Marcus Clyne maccaday at gmail.com
Sun Aug 30 09:58:22 MSD 2009

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