For PHP pseudo-static Rewrite settings, php pseudo rewrite. For PHP pseudo-static Rewrite settings, the main function of php pseudo-rewriteRewirte is to redirect URLs and hide real addresses. it is based on Perl regular expressions. We usually help us implement PHP pseudo static Rewrite settings, php pseudo rewrite
The main function of Rewirte is to redirect URLs and hide real addresses. it is based on Perl-based regular expressions. It usually helps us achieve quasi-static, quasi-directory, domain name jump, and prevent leeching.
I. Apache
Configuration:1. support for httpd. conf configuration 2. support for directory. htaccess configuration (a "distributed configuration" file is intended for virtual spaces, and the space provider does not want to modify the Apache configuration file)
Enable Rewrite (httpd. conf)(Sometimes Options Indexes FollowSymLinks may fail. you only need to configure Options all.) LoadModule rewrite_module modules/mod_rewrite.so
Enable. htaccessAllowOverride None: AllowOverride All
II. mod_rewrite
Rules:Example: RewriteEngine on
->
Start
Rewrite
EngineRewriteRule ^/test ([0-9] * example .html $/test. php? Id = $1
-> When testtestplus any field. html can jump to the test. php regex matching field and store it in virtual memory matching $1
3. mod_rewrite
Rules
Modifier1) R forces external redirection 2) F disables the URL and returns a 403HTTP status code. 3) if G forces the URL to be GONE, the response HTTP status code is returned. 4) P enforces proxy forwarding. 5) L indicates that the current rule is the last rule, and the rule is overwritten after analysis is stopped. 6) N re-run the rewrite process from the first rule. 7) C. associate with the next rule
If the rule matches, it is processed normally. the following modifier is invalid.8) T = MIME-type (force MIME type) force MIME type 9) NS is only used for internal requests rather than 10) NC case-insensitive 11) QSA append request string 12) NE does not output escape special characters \ % 3d $1 is equivalent to = $1 for example:
RewriteRule ^/
New
([0-9] *)/
$/
New
. Php? Id = $1
[R]Simple example:
RewriteEngine onRewriteRule ^/in(.*).html$ /index.php
Easy to implement ~
PHP | pseudo-static | RewriteRule
RewriteEngine On
RewriteRule ^ (. *)/classlist/(. *) $1/class_list.php? Type = $2
</IfModule>
The virtual host is a Linux system, and the website program runs in php + mysql. how can I set pseudo-static state ??
Hello, you have to set up pseudo-static based on your website program and WEB server environment. for example, if you use the LNMP environment, the PHP program is DZ2.5, so your pseudo-static can be:
Rewrite ^ ([^ \.] *)/topic-(. +) \. html $1/portal. php? Mod = topic & topic = $2 last;
Rewrite ^ ([^ \.] *)/article-([0-9] +)-([0-9] + )\. html $1/portal. php? Mod = view & aid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/forum-(\ w +)-([0-9] +) \. html $1/forum. php? Mod = forumdisplay & fid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/thread-([0-9] +)-([0-9] +)-([0-9] + )\. html $1/forum. php? Mod = viewthread & tid = $2 & extra = page % 3D $4 & page = $3 last;
Rewrite ^ ([^ \.] *)/group-([0-9] +)-([0-9] + )\. html $1/forum. php? Mod = group & fid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/space-(username | uid)-(. +) \. html $1/home. php? Mod = space & $2 = $3 last;
Rewrite ^ ([^ \.] *)/blog-([0-9] +)-([0-9] + )\. html $1/home. php? Mod = space & uid = $2 & do = blog & id = $3 last;
Rewrite ^ ([^ \.] *)/(fid | tid)-([0-9] +) \. html $1/index. php? Action = $2 & value = $3 last;
Rewrite ^ ([^ \.] *)/([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] + )\. html $1/plugin. php? Id = $2: $3 last;
If (! -E $ request_filename ){
Return 404;
}
If you have any questions, contact the group owner in group Q + group 222802357.
Rewirte is mainly used to redirect URLs and hide real addresses. it is based on Perl-based regular expressions. Help us to implement...