使用mod_rewrite后找不到图像

发布于 2024-08-21 16:04:10 字数 722 浏览 4 评论 0原文

为了制作漂亮且友好的 SEO 链接,我使用这个:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ page.php?ida=$1&idb=$2 [QSA]

所以 http://www. example.com/solutions/hardware.html 将是: http://www.example.com/page.php?ida=solutions&idb=hardware

这有效。

但问题是没有下载图形元素! (内联图像和 CSS 背景), 字体样式和非图形样式应用得很好,因为 css 样式部分不在单独的 css 文件中,但它嵌入在我的标题部分页面中。

是否需要在我的 .htaccess 文件中添加任何有用的行,因此 images/ 目录将被接受?

请帮忙,我是 .htaccess 的新手!

谢谢,

In order to make nice and friendly SEO links I'm using this:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ page.php?ida=$1&idb=$2 [QSA]

So http://www.example.com/solutions/hardware.html will be: http://www.example.com/page.php?ida=solutions&idb=hardware

This works.

But the problem is there is no graphic element downloaded! (Inline images and css background),
The font style and none graphic style applied well since the css style section is not in a separate css file but it's embeded in my header section page.

Is there any helpful lines to be added in my .htaccess file so therefore images/ directory would be axcepted?

Help please i'm new in .htaccess!

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱桃奶球 2024-08-28 16:04:10

相对 URL 现在从 /solutions/hardware.html 解析,而不是 /page.php?ida=solutions&idb=hardware。这意味着具有相对 URL 路径(如 images/foobar)的引用将解析为 /solutions/images/foobar,而不是 /images/foobar >。

只需使用绝对 URL 路径(如 /images/foobar)来引用外部资源,并且引用独立于基本 URL 的路径。

Relative URLs are now resolved from /solutions/hardware.html and not /page.php?ida=solutions&idb=hardware. That means a reference with a relative URL path like images/foobar would be resolved to /solutions/images/foobar and not to /images/foobar.

Just use absolute URL paths like /images/foobar to reference your external resources and the references are independent from the path of your base URL.

独﹏钓一江月 2024-08-28 16:04:10

尝试:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ page.php?ida=$1&idb=$2 [QSA]

Try:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ page.php?ida=$1&idb=$2 [QSA]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文