Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 正斜杠访问中断样式表_Php_.htaccess - Fatal编程技术网

Php 正斜杠访问中断样式表

Php 正斜杠访问中断样式表,php,.htaccess,Php,.htaccess,我对htaccess和正则表达式很糟糕,所以这不是我真正喜欢的。我正在开发一个导航系统,允许用户像这样选择链接 <a href="home/">Home</a> <a href="about/">About</a> 好的,基本上这允许我重写我的url,但是当我添加/it时,它打破了我的风格,当我查看源代码时,它将链接的名称添加到url中,就像这样 http://localhost/current-project/index/css/default

我对htaccess和正则表达式很糟糕,所以这不是我真正喜欢的。我正在开发一个导航系统,允许用户像这样选择链接

<a href="home/">Home</a>
<a href="about/">About</a>
好的,基本上这允许我重写我的url,但是当我添加/it时,它打破了我的风格,当我查看源代码时,它将链接的名称添加到url中,就像这样

http://localhost/current-project/index/css/default.css
or
http://localhost/current-project/about/css/default.css
何时应该:

http://localhost/current-project/css/default.css

是否只让它重写php文件?

使用类似
/css/default.css
的路径定义样式表和图像,而不仅仅是
css/default.css
。或者,考虑使用基本标记,如

。这将确保所有内容都能正确链接,但你必须记住小心使用相对URL,因为它们是相对于基本文件夹而不是当前文件夹的。

你能在引用css文件的地方显示html代码吗?我也这么想@JohnCrossley-在

http://localhost/current-project/css/default.css