PHP url重写空链接

发布于 2025-01-03 02:14:37 字数 325 浏览 3 评论 0原文

我正在尝试重新连接网址,没关系,但所有带有 href“#”的链接都会转到一个页面。

这是我的网址重写;

     RewriteEngine on
     ReWriteRule ^index$ index.php [L,NC]
     ReWriteRule ^groups/(.*) groupdetail.php?groupid=$1

这是一个普通的链接,指向login.php,所有网址都指向login.php

  <a href="#">Settings</a>

i'm trying to rewirting urls, it's ok but all links with href "#" goes to a page.

here is my url rewriting;

     RewriteEngine on
     ReWriteRule ^index$ index.php [L,NC]
     ReWriteRule ^groups/(.*) groupdetail.php?groupid=$1

and this is an ordinary link which goes to login.php, all urls go to login.php

  <a href="#">Settings</a>

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

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

发布评论

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

评论(1

扮仙女 2025-01-10 02:14:37

是的,我有基本标签,导致避免 url 重写中的 css 文件

标签是你的问题:它正在重写页面上的所有相关链接,包括 #

这就是我非常讨厌 的原因之一。如果可能的话,请考虑使用绝对 URL 来寻址样式表:

<link rel="stylesheet" src="/css/styles.css">

yea, i have base tag cause avodinig css files from url rewrite

The <base> tag is your problem: It is rewriting all your relative links on the page, including #.

This is one reason why I hate <base> with a passion. If at all possible, consider using absolute URLs to address your style sheets instead:

<link rel="stylesheet" src="/css/styles.css">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文