I'm trying to convert the following .htaccess rewrite rule to the appropriate NGINX format.
# Redirect /signup/PLANNAME or /signup/PLANNAME/ --> /signup/index.php?account_type=PLANNAME
RewriteEngine on
RewriteRule ^sig开发者_运维百科nup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 [NC,L]
I tried using the following NGINX rule, but it's not working.
rewrite ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 last;
Any idea what I'm doing wrong to make this work with NGINX? Looking at the official documentation isn't very helpful since the documentation is not very through.
As you're not within a .htaccess file, you have to use absolute paths. As such:
rewrite ^/signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 last;
I found the problem, I was missing the forward slash (/) at the beginning.
Answer:
rewrite ^/signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 last;
精彩评论