将根目录重写为子目录

发布于 2025-01-02 22:09:48 字数 191 浏览 2 评论 0原文

我正在尝试让 www.example.com 显示 www.example.com/content/portal/ 上的内容,

我不需要简单的重定向,网址应显示 www.example.com。我已经尝试过该站点的许多重写代码,但它们都只是重定向页面。

顺便说一句,我确实将非 www 网址重定向到 www。

提前致谢。

I'm trying to get www.example.com to show the content at www.example.com/content/portal/

I'm not wanting a simple redirect, the url should show www.example.com. I've tried a number of the rewrite codes from this site but they all just redirect the page.

BTW I do redirect non-www urls to www.

Thanks in advance.

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

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

发布评论

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

评论(1

你的笑 2025-01-09 22:09:48

将以下内容添加到站点根目录中的 .htaccess 文件中。

RewriteRule ^$ content/portal/ [L]

Add the following to your .htaccess file in the root directory of your site.

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