【发布时间】:2014-06-05 10:00:32
【问题描述】:
我的要求是在 Wordpress 中为现有网站做 SEO 友好的 URL。
例如,
Current URL: http://localhost/test/?pid=19971
that is the page "test" is rendering the data from some custom plugin.
My new SEO URL : http://localhost/brand/sub_category/product_name
Here, Brand, Sub_category and product_name is fetched from the pid..
我正在使用 functions.php 中的以下重写规则填充数据,
add_rewrite_rule(MY_DYNAMICALLY_POPULATED_URL.'$ page-test.php?brand='.$brand_name.'&sub='.$sub_category.'&pname='.$product_name.' [L]', 'top');
在此代码中,page-test.php 放置在根目录中,并通过传递 brand_name、sub_category 和 productname 以获取 pid 从该文件呈现数据.因此,基于 pid 呈现每个产品页面。
这段代码对我来说很好用,当我自动保存数据时,数据会写入.htaccess,并且页面正在使用新的 SEO URL 呈现。
但是当我的客户需要它通过 Apache 中的 FALLBACK 而不是 add_rewrite_rule 时,由于某些负载平衡问题。
那么任何人都可以帮助我如何使用Fallback resource 做同样的事情。
【问题讨论】:
-
最后使用了“page_rewrite_rules”过滤器,我没有将它写入.htaccess文件。
-
重复发布;版主通知。 wordpress.stackexchange.com/questions/141921/… - 应该尽快清理。
-
这个问题似乎离题了,因为它是在 WordPress SE wordpress.stackexchange.com/questions/141921/…987654322@ 上提出并回答的
标签: php wordpress apache .htaccess fallback