重写规则到重写规则?

发布于 2024-09-04 07:12:30 字数 1014 浏览 2 评论 0原文

我想将一个 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。我希望像 ?url=RENDER/34324/4234/234234.html 这样的东西可以通过 $_GET['url'] 在 WordPress 页面 render-product 上访问。

我做错了什么?

I want to write a RewriteRule to another RewriteRule, but I can't seem to get things to work. I'm having troubel with the line

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

in this file:

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]

Basically, the url render-product is a url frendly url created by wordpress. I want something like ?url=RENDER/34324/4234/234234.html to be accessible on the wordpress page render-product via $_GET['url'].

What am i doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玻璃人 2024-09-11 07:12:30
RewriteRule ^(eTool/)?(RENDER/\d+/\d+/\d+/\d+\.html)$ index.php?pagename=render-product&url=$2 [L,NC]

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

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

I've suggested rewriting the URL to WP as query parameters, since WP won't parse the permalink of the rewrited URL, it will only examine the original URI request (if that makes sense!?).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文