WordPress pseudo-static rules (Nginx/apache/iis)

Source: Internet
Author: User

The server has been running around for a long time.

The environment is also exchanged for several

Apache and nginx;

Always environment problems

Tested, the following code is perfectly compatible with the pseudo-static rules of Nginx.

 

The code is as follows: Copy code
Rewrite ^. */files/(. *) $/wp-nodes des/ms-files.php? File = $1 last;
If (! -E $ request_filename ){
Rewrite ^. +? (/Wp-. *) $1 last;
Rewrite ^. +? (/. *. Php) $1 last;
Rewrite ^/index. php last;
}


Insert the above code into the server {…} of/usr/local/nginx/conf/nginx. conf {...} Or you can add them in other ways.

Restart nginx (/etc/init. d/nginx restart) to take effect.


If the space uses a Linux + Apache environment and supports writing. htaccess files, the pseudo-static state can be implemented as long as it is set in the WP background. If the. htaccess file cannot be automatically written, you must manually configure the. htaccess file.

The code is as follows: Copy code

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule./index. php [L]
</IfModule>

If you are using a Windows + IIS system, the pseudo-static method is to configure the web. config file. In This server environment, the WordPress pseudo-static method is applicable to systems that support aspx.

The code is as follows: Copy code

<? Xml version = "1.0 & Prime; encoding =" UTF-8 & Prime;?>
<Configuration>
<System. webServer>
<Rewrite>
<Rules>
<Rule name = "wordpress" patternSyntax = "Wildcard">
<Match url = "*"/>
<Conditions>
<Add input = "{REQUEST_FILENAME}" matchType = "IsFile" negate = "true"/>
<Add input = "{REQUEST_FILENAME}" matchType = "IsDirectory" negate = "true"/>
</Conditions>
<Action type = "Rewrite" url = "index. php"/>
</Rule>
</Rules>
</Rewrite>
</System. webServer>
</Configuration>

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.