Rewrite rule from apache


#1

I’m new to nginx. I’ve got it all set up apart from a few rewrite rules
I need to add from apache, these are:

RewriteRule ^bg_sound_([^_]*).xspf$
/includes/bg_audio_player/bg_sound.php?tributeid=$1
RewriteRule ^elvis$ tributeindex.php?artiste=elvis

rewrite rules seem a little complicated in nginx (or just different), I
think I will be able to work my other rules out if somebody could help
me with these two.

Thank You, Matt

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2537,2537#msg-2537


#2

figured them out:

rewrite ^/bg_sound_([^_]*).xspf$
/includes/bg_audio_player/bg_sound.php?tributeid=$1 break;
rewrite ^/adamcarter$ /tributedetails.php?name=elvis_adam_carter&page=1
break;

I have one problem now, that is that they are not processed by php as
the rewrites are in the “location /” and not “location ~.*php$”, is
their any way to fix this other than putting the fastcgi lines in the
“location /” section?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2537,2557#msg-2557


#3

Please post your configuration file(s).

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2537,2560#msg-2560


#4

Thank you for your help, I moved the rules into the main server section
and they work, why didn’t I think of that. Planning on moving from
Apache later this week, some pages are loading around twice as fast as
apache.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2537,2575#msg-2575


#5

On Tue, 2009-06-02 at 06:00 -0400, matt91 wrote:

figured them out:

rewrite ^/bg_sound_([^_]*).xspf
$ /includes/bg_audio_player/bg_sound.php?tributeid=$1 break;
rewrite ^/adamcarter
$ /tributedetails.php?name=elvis_adam_carter&page=1 break;

I have one problem now, that is that they are not processed by php as
the rewrites are in the “location /” and not “location ~.*php$”,

location ~ .php$

is their any way to fix this other than putting the fastcgi lines in
the “location /” section?

You shouldn’t need to. Post your config file here.

Cliff