简体   繁体   中英

htaccess to nginx rewrite rules

I've recently moved from an Apache to a Nginx webserver, however a script seems to have issues due to rewrite rules that are not properly working.

I've tried winginx.com, a website that offers conversion from htaccess to nginx however it does not really seem to work

The rewrites are the following:

RewriteRule ^people/([0-9]+)$ people.php?p=$1 [NC,L]
RewriteRule ^user/([0-9]+)$ profile.php?id=$1 [NC,L]
RewriteRule ^user/([0-9]+)/photo_upload$ profile.php?id=$1&photo_upload=true [NC,L]
RewriteRule ^index.php?login/?$ index.php?login [NC,L]
RewriteRule ^visitors/?$ visitors.php [NC,L]

Some expert help would be greatly appreciated, thank you

These rewrites should work:

rewrite ^people/([0-9]+)$ /people.php?p=$1 last
rewrite ^user/([0-9]+)$ /profile.php?id=$1 last
rewrite ^user/([0-9]+)/photo_upload$ /profile.php?id=$1&photo_upload=true last
rewrite ^index.php\?login/?$ /index.php?login last
rewrite ^visitors/?$ /visitors.php last

Add them either to you main location, or out of all location blocks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM