我刚刚创建了一个新的 wordpress 页面模板,在其中运行一些 php 和 mysql 脚本,我想将 mod 重写应用于它的子页面。
例如我生成了以下链接:
http://www.quotist.com/quotes-by-authors.html?letter=D
我怎样才能把它变成类似这样的东西:
http://www.quotist.com/quotes-by-authors/letter/d/ ?
在我的 htaccess 中,我有 wordpress 生成的默认代码 ...
有人知道如何实现吗?
最佳答案
试试这个:
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
RewriteCond %{QUERY_STRING} ^(letter)=(\w)$ [NC]
RewriteRule ([^.]+)\.html http://www.quotist.com/$1/%1/%2? [L,R=301]
RewriteCond %{REQUEST_URI} ^/([\w-]+)/(letter)/\w/? [NC]
RewriteRule ^ /%1.html?%2=%3 [L,QSA]
关于wordpress - 漂亮的 url 与 .htaccess?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9309380/