我在 .htaccess
中写了这些文件:
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^user/([^/]*)(/?)+$ profile.php?id=$1 [L]
但是当我要去 site.com/user/nickname
, 所有相关内容正在加载 user
文件夹。
那是我的style.css
位于根文件夹中的文件未加载。我不想编辑我的所有代码。
示例:我已将这些写入我的所有代码:<img src="uploads/some_image.jpg">
.我不想将其更改为 <img src="/uploads/some_image.jpg">
.
最佳答案
I don't want to change this to
<img src="/uploads/some_image.jpg">.
但这就是你应该做的。作为替代方案,您可以使用 <base>
标签 <base href="/" />
在 <head>
内.我不建议您使用更多重写规则来解决这个问题。
关于php - 如何编辑 htaccess 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23429221/