Enable nginx to support. htaccess files in Centos to implement pseudo-static methods

Source: Internet
Author: User


Enable nginx support in Centos. the htaccess file implements pseudo-static search methods. Many people say nginx does not support this method currently. I tried the htaccess file according to the nginx rules and found that nginx is fully supported. htaccess file! The method is as follows: 1. before using. create a directory in the htaccess file. htaccess file, such as one of my Discuz Forum directories: vi/var/www/html/bbs /. htaccess www.2cto.com 2. enter a rule in it. Here I enter the pseudo-static rule of Discuz: # nginx rewrite rulerewrite ^ (. *)/archiver/(fid | tid0000-0000w-00000000.html) $1/archiver/index. php? $2 last; rewrite ^ (. *)/forum-(%0-9%%%}-(%0-9%%%%%%%.html $1/forumdisplay. php? Fid = $2 & page = $3 last; rewrite ^ (. *)/thread-(0-9000000000000-(0-9000000000000-(0-90000000000000000.html $1/viewthread. php? Tid = $2 & extra = page % 3D $4 & page = $3 last; rewrite ^ (. *)/profile-(username | uid+-(.20.20..html $1/viewpro. php? $2 = $3 last; rewrite ^ (. *)/space-(username | uid+-(.20.20..html $1/space. php? $2 = $3 last; rewrite ^ (. *)/tag-(.20.20..html $1/tag. php? Name = $2 last; # end nginx rewrite rulewq save and quit. 3. modify the nginx configuration file: www.2cto.com vi/etc/nginx. conf4. introduce in server {} of the virtual host to be added with pseudo-static state. htaccess file, include/var/www/html/bbs /. htaccessinclude/var/www/html/bbs /. htaccess; (change this to you. location of the htaccess file) wq is saved and exited. 5. reload the nginx configuration file:/etc/init. d/nginx reload. Open the webpage again. If the pseudo-static state is normal, your rewrite rule syntax is correct.

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.