Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a wierd problem with nginx, it doesn't want to rewrite...

I have this configuration and i need to pass a hash (40 chars) to a php file it works with apache mod_rewrite but with nginx it isn't i even tried to do simple rewrites, it simply doesn't work

server {
        location / {
            rewrite ^aa$ /downloadTORRENTZ.php break;
            root   /usr/share/nginx/html;
            index  index.html index.htm;
            rewrite  "^([A-Z0-9]{40})$" /file.php?ddl=$1 break;
share|improve this question
From @staafl: What OS are you using? I'm sorry for not commenting, but I don't have the rep. – HopelessN00b Aug 24 '12 at 2:48
  1. Remove "" from your regexp
  2. request usually start with / so your regexp should look like

    rewrite ^/([A-Z0-9]{40})$ /file.php?ddl=$1 break;

  3. Is your hash ALLCAPS? Maybe you should use [a-zA-Z0-9]

  4. 40 characters... It looks like sha1 hash. May be you should simplify regexp to [0-9A-F]

share|improve this answer
Yep, was missing a preceding / – Dylan Valade Jul 10 '15 at 19:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.