Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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;
–
request usually start with / so your regexp should look like
rewrite ^/([A-Z0-9]{40})$ /file.php?ddl=$1 break;
Is your hash ALLCAPS? Maybe you should use [a-zA-Z0-9]
40 characters... It looks like sha1 hash. May be you should simplify regexp to [0-9A-F]