简体   繁体   English

在一个插件中的Wordpress mod_rewrite?

[英]Wordpress mod_rewrite within a plugin?

I tried several mod_rewrite but I asking your help, because this is a complicated matter. 我尝试了几个mod_rewrite,但我请求你的帮助,因为这是一个复杂的问题。

Wordpress has its own permalink structure that uses mod rewrite to make the url's search engine friendly. Wordpress有自己的永久链接结构,使用mod重写使url的搜索引擎友好。

I have 2 plugins. 我有2个插件。 1. Turns a page into a subdirectory. 1.将页面转换为子目录。 So domain.com/page/ turns into page.domain.com 2. The second one is a forum that creates pages such as /?mingleforumaction=viewforum&f=2.0 and ?mingleforumaction=viewtopic&t=23.0 所以domain.com/page/变成了page.domain.com 2.第二个是创建页面的论坛,例如/?mingleforumaction = viewforum&f = 2.0和?mingleforumaction = viewtopic&t = 23.0

How can I turn the current 我怎样才能转动电流

http://page.domain.com/?mingleforumaction=viewtopic&t=23.0

to

http://page.domain.com/title-of-the-forum-topic/

Why not to ask plugin author? 为什么不问插件作者? Are you sure your plugins will handle such structure? 您确定您的插件会处理这种结构吗? If yes, then why there is no mod_rewrite rules shipped with them? 如果是,那么为什么没有随附的mod_rewrite规则?

You can't do it based solely on the topic title, those aren't unique. 你不能仅仅根据主题标题来做,这些并不是唯一的。 You could, however, do http://page.domain.com/23.0/title-of-the-forum-topic/ where 23.0 is obviously the value that t would be set to in the query string. 但是,您可以执行http://page.domain.com/23.0/title-of-the-forum-topic/ ,其中23.0显然是查询字符串中将t设置为的值。

Edit 编辑

RewriteEngine on
RewriteRule ^/topic/([0-9\.]+)/ /?mingleforumaction=viewtopic&t=$1

openid does not let me login from home because of a different IP, but I am the same person as the topic starter: openid不允许我因为不同的IP而从家里登录,但我和主题启动者是同一个人:

@spartan018 How can that be done? @ spartan018怎么办?

@FractalizeR The developer http://cartpauj.com/projects/mingle-forum-plugin/ used an older forum plugin and does not have the knowledge (or perhaps time to learn) to rewrite the plugin for it to have mode_rewrite rules shipped with in of have the plugin work with the permalink structure of wordpress. @FractalizeR开发人员http://cartpauj.com/projects/mingle-forum-plugin/使用了较旧的论坛插件,并且不具备重写该插件的知识(或者可能没有时间去学习),因为它附带了mode_rewrite规则其中的插件可与wordpress的永久链接结构配合使用。 So I was hoping to help him, but got stuck myself because normal .htaccess mod_rewrite do not seem to work and it is based on an already existing wordpress mod_rewrite. 因此,我希望为他提供帮助,但是由于正常的.htaccess mod_rewrite似乎不起作用,并且它基于已经存在的wordpress mod_rewrite而陷入困境。 That is why I asked for help :) 这就是我寻求帮助的原因:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM