For NGINX pseudo-static, please refer to it. thank you.

Source: Internet
Author: User
For NGINX pseudo-static, please refer to the following link: Thank you. This post was last edited by u010993957 at 22:12:42.


Local test URL

Content 1 connection address http: // 127.0.0.1/ask /? Ct = question & askaid = 1
Content 2 connection address http: // 127.0.0.1/ask /? Ct = question & askaid = 2
Content 3 connection address http: // 127.0.0.1/ask /? Ct = question & askaid = 3
Content 4 connection address http: // 127.0.0.1/ask /? Ct = question & askaid = 4
Content 5 connection address http: // 127.0.0.1/ask /? Ct = question & askaid = 5


This is true after pseudo-static

Http: // 127.0.0.1/ask/1.html
Http: // 127.0.0.1/ask/2.html
Http: // 127.0.0.1/ask/3.html
Http: // 127.0.0.1/ask/4.html
Http: // 127.0.0.1/ask/5.html

How to write NGINX pseudo-static rules? thank you!





Reply to discussion (solution)

Nginx only supports address rewriting and access
Http: // 127.0.0.1/ask/1.html
Rewrite
Http: // 127.0.0.1/ask /? Ct = question & askaid = 1
To execute the php script


If (! -F $ request_filename ){
Rewrite ^ ([^ \.] *)/(\ d +) \. html $1 /? Ct = question & askaid = $2 last;
}

Nginx only supports address rewriting and access
Http: // 127.0.0.1/ask/1.html
Rewrite
Http: // 127.0.0.1/ask /? Ct = question & askaid = 1
To execute the php script


If (! -F $ request_filename ){
Rewrite ^ ([^ \.] *)/(\ d +) \. html $1 /? Ct = question & askaid = $2 last;
}






RewriteEngine On
RewriteRule into index.html $ index. php
RewriteRule syntax (%0-9%%%%%.html $? Ct = question & askaid = $1
RewriteRule ^ ([0-9] +) $? Ct = browser & tid = $1
RewriteRule ^ t ([0-9] +) $? Ct = browser & tid2 = $1


Can the APACHE pseudo-static rules help me convert NGINX? thank you very much.

Rewrite ^/index.html $/index. php last;
If (! -F $ request_filename ){
Rewrite ^/(%0-9%%%%.html $ /? Ct = question & askaid = $1 last;
Rewrite ^/([0-9] +) $ /? Ct = browser & tid = $1 last;
Rewrite ^/t ([0-9] +) $ /? Ct = browser & tid2 = $1 last;
}

Rewrite ^/index.html $/index. php last;
If (! -F $ request_filename ){
Rewrite ^/(%0-9%%%%.html $ /? Ct = question & askaid = $1 last;
Rewrite ^/([0-9] +) $ /? Ct = browser & tid = $1 last;
Rewrite ^/t ([0-9] +) $ /? Ct = browser & tid2 = $1 last;
}


Add the NGINX configuration file

"Include/home/lum_safe_files/htaccess_files/. htaccess_ask ;"


"Rewrite ^/index.html $/index. php last;" is written in. htaccess_ask ;"

I use pseudo-static http: // 127.0.0.1/ask/index. php to make it http: // 127.0.0.1/ask/index.html

NGINX is also restarted. it seems that it still doesn't work. I don't know what's going on.








Rewrite ^/index.html $/index. php last;
If (! -F $ request_filename ){
Rewrite ^/(%0-9%%%%.html $ /? Ct = question & askaid = $1 last;
Rewrite ^/([0-9] +) $ /? Ct = browser & tid = $1 last;
Rewrite ^/t ([0-9] +) $ /? Ct = browser & tid2 = $1 last;
}


My directory is a level-2 Directory.

Ask Directory

Nginx uses the conf file instead of. htaccess.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.