Rewrite rules problems.

Jérémy Dierx jeremy.dierx at
Wed Jun 6 10:34:40 MSD 2007


I have some problems with rewrite rules.
First, excuse me for my bad English...

I have an htacces from Apache like :

RewriteEngine on
DirectoryIndex gabarit.php?contenu=itineraire
RewriteCond %{REQUEST_URI} !temporaire\.htm
RewriteRule ^([a-z-]*)\.htm$  gabarit\.php?contenu=$1 [L]
RewriteRule ^galeries/$ gabarit\.php?contenu=accueil-galerie [L]
RewriteRule ^galeries/([0-9]*)/([0-9]*)\.htm$ gabarit
\.php?contenu=detail-galerie&categorie=$1&galerie=$2 [L]

I want to translate it to Nginx rewrite rules

Here, a piece of my conf that doesn't work :

  location /
    index gabarit.php;
    root  /home/work/jnbarak/current;

    rewrite ^/(.*)\.htm$  /gabarit.php?contenu=$1 last; # it works !
    rewrite ^/galeries/$ /gabarit\.php?contenu=accueil-galerie? last; #
it doesn't work !
    rewrite ^/galeries/([0-9]*)/([0-9]*)\.htm$ /gabarit
\.php?contenu=detail-galerie&categorie=$1&galerie=$2 last; # it doesn't
work !

  # pass the PHP scripts to FastCGI server listening on
  location ~ \.php$
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /home/work/jnbarak/current
    include /usr/local/nginx/conf/fastcgi.conf;

When I try :


I have the error :

"No input file specified."

When I try :


I am redirect to :


Some one can help me please ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list