php - 如何使用 .htaccess 更改标签方向?
问题描述
我使用 .htaccess 更改我的网址
http://example.com/profile.php?user_id=115451
至
http://example.com/profile/115451
这是我的 .htaccess 它对我有用。
RewriteEngine On
RewriteRule ^profile/([^/]+)/?$ profile.php?user_id=$1 [L,QSA]
但是在我的 profile.php 中有一个这样的标签
<a href='./'>Home</a>
当我单击此链接时,它应该转到http://example.com/但它转到http://example.com/profile/
img 标签也有同样的问题,http ://example.com/profile/115451 上的图片无法加载,
解决方案
您正在寻找的正是:
<a href='/'>Home</a>
.htaccess 中没有任何改变
推荐阅读
- oracle - 无法从 SQL Developer 检索乌尔都语/阿拉伯语数据
- django - 在 Django/Postgres 中存储挂钟日期时间
- git - Git:将多个提交组合成一个提交
- python - Python Pandas - 转换列的数据类型引发 NotImplementedError
- python - Python 3 中的简单正则表达式替换“|”之间的文本 和“/”符号
- angular - Angular 7没有正确下载文件
- python - 在字符串中查找子字符串
- azure - 将 PowerShell 脚本添加到 Azure 市场优惠
- sql-server - 将日期转换为年数
- latex - Sphinx 在 LaTeX 输出中从 0 开始章节编号