Apache 常用伪静态配置

1. /a/b?c=d => index.php?_a=a&_m=b&c=d

2. /xxx/detail-yyy.html => index.php?_a=xxx&_m=detail&id=yyy

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^$ index.php?_a=index&_m=index&%1 [L]
RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([0-9a-zA-Z]*)$ index.php?_a=$1&_m=index&%1 [L]
RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([0-9a-zA-Z]*)/([0-9a-zA-Z]*)$ index.php?_a=$1&_m=$2&%1 [L]

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([0-9a-zA-Z]*)/detail-([0-9]*).html$ index.php?_a=$1&_m=detail&id=$2&%1 [L]

  

原文地址:https://www.cnblogs.com/hefei/p/5509252.html