Nginx Support. Method of htaccess pseudo-static rewrite

Source: Internet
Author: User

1. Create a new. htaccess file in the directory where you need to use the. htaccess file

this. htaccess file General Discuz, DEDECMS and other systems have their own

#. htaccess Rewrite rule

Rewrite ^ (. *)/archiver/((Fid|tid)-[w-]+.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-9]+)-([0-9]+)-([0-9]+). html$ $1/viewthread.php?tid=$2&extra=page%3d$4&page=$3 Last

Rewrite ^ (. *)/profile-(USERNAME|UID)-(. +). html$ $1/viewpro.php?$2=$3 last;

Rewrite ^ (. *)/space-(USERNAME|UID)-(. +). html$ $1/space.php?$2=$3 last;

Rewrite ^ (. *)/tag-(. +). html$ $1/tag.php?name=$2 last;

# end. htaccess rewrite rule

2. Then modify the nginx.conf to introduce the. htaccess file in the server{} of the virtual host that needs to add pseudo static.

server{

Include xxxx/.htaccess; # # (change this to the exact location of your. htaccess file)

}

Restart the nginx.conf.

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.