Drupal:如何重写所有网址以使安装目录不包含在链接中

发布于 2024-08-21 20:50:39 字数 450 浏览 3 评论 0原文

我在我的网站上安装了 drupal,例如 example.co.uk/portfolio

所有链接均显示为 example.co.uk/portfolio/project-1

我希望它是 example.co.uk/project-1

我如何使用重写规则或其他规则,以便只要有一个链接显示 /portfolio 目录,它根本不会在 href 中显示它?我希望能够隐藏该网站安装在一个目录中,并希望它显示根 url www.example.co.uk/ 中的所有内容

到目前为止, 我搞乱了 RewriteBase / 并通过以下方式将投资组合映射到主根:

RewriteRule ^/?$ /portfolio

I installed drupal on my site at say, example.co.uk/portfolio.

All the links are showing as example.co.uk/portfolio/project-1.

I want it to be example.co.uk/project-1

How can I use rewrite rules or whatever so that wherever there is a link that has the /portfolio directory showing, that it will not show it in the href at all? I want to be able to hide that the site is installed in a directory and want it to show everything from the root url www.example.co.uk/

So far,
I've messed around with RewriteBase / and also mapping the portfolio to the main root via:

RewriteRule ^/?$ /portfolio

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

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

发布评论

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

评论(1

花开浅夏 2024-08-28 20:50:39

在根目录的 .htaccess 文件中尝试此 mod_rewrite 规则:

RewriteEngine on
RewriteRule !^portfolio/ portfolio%{REQUEST_URI}

Try this mod_rewrite rule in the .htaccess file in your root directory:

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