RewriteRule to RewriteRule?

时间:2010-06-03 21:08:14

标签: wordpress .htaccess mod-rewrite

我想写一个RewriteRule到另一个RewriteRule,但我似乎无法让事情发挥作用。我对这条线有麻烦

RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ render-product?url=$2 [L,NC]

在此文件中:

RewriteEngine On
RewriteBase /

RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ render-product?url=$2 [L,NC]

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

RewriteRule . index.php [L]

基本上,url render-product是由wordpress创建的url frendly url。我希望通过$ _GET ['url']在WordPress页面渲染产品上访问类似?url = RENDER / 34324/4234/234234.html。

我做错了什么?

1 个答案:

答案 0 :(得分:3)

RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ index.php?pagename=render-product&url=$2 [L,NC]

我建议将WP的URL重写为查询参数,因为WP不会解析重写URL的永久链接,它只会检查原始的URI请求(如果有意义的话?)。