我的htaccess文件需要一些简单的帮助,谢谢你。
我有一些网站网址,例如:
我想使用RewriteEngine将上述链接分别更改为:
以下是我正在使用的.htaccess代码:
RewriteEngine On
RewriteRule ^solutions/overview index.php?page_path=solutions-overview.html
RewriteRule ^solutions/a index.php?page_path=solutions-a.html
这样可行,但是我的所有图像,CSS文件和JS文件都不再加载,因为页面正在尝试获取错误的URL。例如“/images/blah.jpg”正在加载为“/solutions/images/blah.jpg”。
如何修改htaccess代码以防止相对URL发生变化?
谢谢!
答案 0 :(得分:4)
将此行<BASE href="http://www.yoursitename.com/">
添加到<head>
标记内的页面,如下所示:
<head>
<title>Your site title</title>
<BASE href="http://www.yoursitename.com/">
....
</head>