After searching and testing on the Internet, it is found that the rewrite rules of Nginx and the Rewite rules of Apache are not very different, and can be used almost directly. Like writing rules like this in Apache.
Rewrite
The Apache module Mod_rewrite provides a rewrite engine based on the regular expression parser to rewrite URL requests in real time. It supports a flexible and powerful URL manipulation mechanism in which each full rule can have an unlimited number of sub-rules and additional conditional rules. This URL operation can d
Wordpress
WordPress is still the world's most popular blog system, more and more by the WordPress built Web site in the use of Nginx Server Software, here to share the WordPress nginx rewrite rules:
server {Listen 80;
server_name www.jb51.net jb51.net;
Access_log/data/logs/
, respectively:The code is as follows :Rewritecond%{request_uri} ^secure_page\.php$Rewritecond%{https}!onRewriterule ^/? (secure_page\.php) $ https://www.jb51.net/$1 [r=301,l]The above rule tests whether the {Request_uri} value equals our secure page code, and {HTTPS} is not equal to on. If both conditions are met, the request is redirected to the Security Service URI. In addition you can {Server_port} do the same test, 443 is a common Security service portThe code is as follows :Rewritecond%{r
1. Determine if Apache has loaded the Mod_rewrite moduleLoadModule Rewrite_module Modules/mod_rewrite.so is commented out to remove the previous #2. Let Apache support. htaccessLocate the following codeallowoverride NoneRequire all deniedChange allowoverride None to allowoverride allThis allows the. htaccess file to be enabled.3. Create a. htaccess filePut it in the project directory and write your own rules inside.4. Restart the Apache serverReStart
Parameter problems of Nginx redirection
When writing rewrite redirection rules to a website, I encountered this parameter handling problem about redirection. By default, Nginx will automatically add the parameter portion of the old address after rewrite, which may be super
Talking about the difference between rewrite of apache and nginx. For more information, see 1. Nginx Rewrite rule related commands.
Commands related to Nginx Rewrite rules include if,
The use of pseudo-static in nginx directly writes rules in nginx. conf, and does not require pseudo-static operations like apache to enable the write module (mod_rewrite.Nginx only needs to open the nginx. conf configuration file and write the required rules in the server.Ng
This article aims to provide users with basic methods and clues on how to use Apache rewrite rules to solve the title of some common URL Rewrite methods.
This article aims to provide you with basic methods and clues on how to use Apache rewrite rules to solve the titles of c
Label:Detailed description of the. htaccess Rewrite rulesAuthor Freemouse July 22, 2010With Apache virtual host a lot of friends, Apache provides. The htaccess module can set rewrite rules for each virtual host, which is useful for SEO optimization of the site and also improves the user experience. Domestic virtual machines are generally not available. Htaccess f
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.