如何使用htaccess的改变图像路径?如何使用、路径、图像、htaccess

2023-09-02 09:42:57 作者:你会想起我么

我解决这个的Joomla网站。它使用的Joomla 1.7语言过滤器,因此增加了修复后的URL。所以,当我查看与图像的artcle,图像不显示。 我想htaccess的重写规则。但它并没有为我工作... 这是我所得到的,当我复制图片地址。

I'm fixing this joomla site. It uses joomla 1.7 language filter so it adds post fixes to the url. So when i view an artcle with images, image is not displaying. I tried htaccess rewrite rules. But it didn't work for me... this is what i get when i copy image url.

https://m.xsw88.com/allimgs/daicuo/20230902/72.png

但是,当我检查的C公司图像/ myimage.png的$ C $ 。 如果我修改code到 /images/myimage.png 它的工作原理。

But when I check the code its images/myimage.png . If i edit code to /images/myimage.png it works.

t这是我尝试做htaccess的太多,添加一个/。因为它没有工作,我想我不得不改变整个URL。 我没有太多的知识重写。 你们能帮助我吗?

Tthis is what i try to do with htaccess too, to add a "/". Since it didn't work i guess i have to change whole url. I don't have much knowledge in rewriting. Can you guys help me please?

推荐答案

给这个一展身手在你的.htaccess:

Give this a go in your .htaccess:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^.*/images/(.*)$ http://%{HTTP_HOST}/images/$1 [L,R=301]
</IfModule>

这将改写您的 / EN /图像/...要求 /图像/...

请注意,这可能对其他URL意想不到的后果。我建议适当在自己的应用程序测试此。

Note, this could have unexpected consequences for other URLs. I would suggest properly testing this on your own application.