Jun 12

If your blog system is wordpress on apache, and you use rewrite rule for it. I’m looking for a way to implement WordPress’s simple htaccess pretty url rules for Nginx.

.htaccess file:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Fllow is my nginx’s rewrite rule for wordpress:
location / {
index index.php index.html;
if (!-e $request_filename)
{
rewrite ^/(.+)$ /index.php?p=$1 last;
}
}

Tagged with:
Dec 28

Regular expressions to match, of which:
* ~ For the case-insensitive match
* ~ * For the case-insensitive match
*! ~ And! ~ * Are case-sensitive does not match and are not case-sensitive documents and directories do not match to match, of which:
*-F and!-F used to determine the existence of a document
*-D and!-D used to determine the existence of directory
*-E and!-E used to determine the existence of files or directories
*-X and!-X used to determine whether the executable fileflag markers are:
* Last equivalent to Apache’s [L] tag that complete rewrite, no longer match the back of the rules
* Break with the last similar
* Redirect the return of 302 temporary redirect
* Permanent return of 301 permanent redirect some of the available global variables can be used to determine the conditions (to be completed)
$args $ args
$content_length $ content_length
$content_type $ content_type
$document_root $ document_root
$document_uri $ document_uri
$host $ host
$http_user_agent $ http_user_agent
$http_cookie $ http_cookie
$limit_rate $ limit_rate
$request_body_file $ request_body_file
$request_method $ request_method
$remote_addr $ remote_addr
$remote_port $ remote_port
$remote_user $ remote_user
$request_filename $ request_filename
$request_uri $ request_uri
$query_string $ query_string
$scheme $ scheme
$server_protocol $ server_protocol
$server_addr $ server_addr
$server_name $ server_name
$server_port $ server_port
$uri $ uri

 

 

Tagged with:
preload preload preload