如何在WordPress中以这种方式重写URL?

发布于 2025-02-14 00:43:17 字数 407 浏览 0 评论 0原文

- 我的主要逻辑页面是在“ site.com/main-page/”。
- 我需要的是:访问者可以请求任何URL(不是现有的物理文件或文件夹),而当他们在浏览器地址栏中看到所请求的URL时,这些内容是从我们的主处理页面上提供的,请访问“ site.com/main” -page/“”
- 在.htaccess中添加此行无效,并且访问者会遇到404错误。

RewriteRule ^.$ /main-page/ [L] #custom line added
RewriteRule ^index\.php$ - [L] #default code by WP. Custom code added above this line.

WordPress中有哪些替代方案可以实现我需要的东西?

谢谢。

– My main logic page is at “site.com/main-page/”.
– What I need is: A visitor can request whatever URL (not an existing physical file or folder) and while they see their requested URL in their browser address bar, the content is served from our main processing page at “site.com/main-page/”
– Adding this line in .htaccess did not work and visitors get a 404 error.

RewriteRule ^.$ /main-page/ [L] #custom line added
RewriteRule ^index\.php$ - [L] #default code by WP. Custom code added above this line.

What are the alternatives available in WordPress to achieve what I need?

Thank you.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文