Rewrite rules problems.

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


Hello,

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 127.0.0.1:9000
  #
  location ~ \.php$
  {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /home/work/jnbarak/current
$fastcgi_script_name;
    include /usr/local/nginx/conf/fastcgi.conf;
  }


When I try :

http://my_domain.tld/galeries/

I have the error :

"No input file specified."

When I try :

http://my_domain.tld/galeries/1/5.htm

I am redirect to :

http://my_domain.tld/gabarit.php?contenu=accueil-galerie


Some one can help me please ?

Jérémy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070606/a58318f2/attachment.html>


More information about the nginx mailing list