【发布时间】:2009-07-13 02:00:26
【问题描述】:
我再次发布这个问题是因为我解释得不够清楚。以下是我需要使用 .htaccess 文件实现的目标:
- 将 /public_html/ 重新路由到 /public_html/myfolder/
- 制作 website/index.php?q=param 为 website/param/
- 我的 php 文件位于 /public_html/myfolder/ 中,而我的图像文件位于 /public_html/myfolder/images/ 中
Options -Indexes RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} !^www\.website\.com$ [NC] RewriteRule .* https://www.website.com/$1 [L,R=301] RewriteRule ^$ myfolder/index.php [L] # Rewrite rules <IfModule mod_rewrite.c> #RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ myfolder/index.php?q=$1 [L,QSA] </IfModule>
问题是,它重定向很好.. 但我看不到任何图像!它似乎没有加载我的 js、css 等。
这是我得到的错误:
1<br />
2<b>Notice</b>: Undefined property: stdClass::$component in <b>/home/website/mypage/includes/Template.class.php</b> on line <b>31</b><br />
【问题讨论】:
-
问题可能是您的资源页面上有相对链接(images/css/js)。如果是这种情况,请考虑将它们更改为 root-relative 格式。