Rewrite

Hello,

i want rewrite my website Blog Sites.

At moment the Sites are blog.html?id=.

I try to rewrite from article-.html to the site
blog.html?id=.

Im not sure i understand the rewrite docu correct, i has the follow
lines in
the virtuell Server under location / ,

if (!-f $request_filename) {
rewrite “^/article-([0-9]).html$ /blogdetail.html?id=$1” last;
}

but there i have only 404 in the log. rewrite_log is on, but nothing
write me
in the log.

Where is my mistake?

Nice day.

Silvio

On 23 Jun 2011 00h25 WEST, [email protected] wrote:

lines in the virtuell Server under location / ,

if (!-f $request_filename) {
rewrite “^/article-([0-9]).html$ /blogdetail.html?id=$1” last;
}

Try this:

location /article-(\d+).html$ {
try_files $uri $uri/ /blog.html?id=$1; # Is it blog.html or
blogdetail.hmtl?
}

— appa

On Thu, 23 Jun 2011 00:32:15 +0100 Antnio P. P. Almeida wrote:

Try this:

location /article-(\d+).html$ {
try_files $uri $uri/ /blog.html?id=$1; # Is it blog.html or
blogdetail.hmtl? }

Thanks for answer. Its blogdetail. Is same, it come 404.

server { listen; server_name ; access_log /usr/local/www/vserver/silviosiefke.de/log/access.log main; error_log /usr/local/www/vserver/silviosiefke.de/log/error.log;

location / {
root /usr/local/www/vserver/silviosiefke.de/data;
index index.php index.html index.htm;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/local/www/nginx-dist;
}

location /article-(\d+).html$ {
try_files $uri $uri/ /blogdetail.html?id=$1;

pass the PHP scripts to FastCGI

location ~ .(php|htm|html)$ {
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/vserver/data
$fastcgi_script_name; include /usr/local/etc/nginx/fastcgi_params;
}

location ~ /.ht {
deny all;
}
}

- - [23/Jun/2011:01:43:19 +0200] "GET /article-1.html HTTP/1.1" 404 31 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30" "-"

Regards
Silvio

On 23 Jun 2011 00h32 WEST, [email protected] wrote:

Oops forgot the ~* in the location:

location ~* /article-(\d+).html$ {
try_files $uri $uri/ /blog.html?id=$1; # Is it blog.html or
blogdetail.hmtl?
}

— appa

On Thu, 23 Jun 2011 00:48:42 +0100 Antnio P. P. Almeida wrote:

On 23 Jun 2011 00h32 WEST, [email protected] wrote:

Oops forgot the ~* in the location:

location ~* /article-(\d+).html$ {
try_files $uri $uri/ /blog.html?id=$1; # Is it blog.html or
blogdetail.hmtl? }

yes, thank u very very much. Now it running. Fantastic.

Thx, nice day.

Silvio