[英]Redirect many images via 301 htaccess / php?
An image gallery has 120,000 images. 图像库中有120,000张图像。 I want to change URL such as this:
我想更改如下网址:
/album_mod/upload/8c3d534a1451c87aca1fa710be6be8.jpg
to this, using a 301 redirect with a .htaccess file: 为此,使用带有.htaccess文件的301重定向:
/image/gallery/category-a8/imagename-i6282.jpg
However, my problem is that the original URL has no ID in the URL. 但是,我的问题是原始URL在URL中没有ID。 My idea is to:
我的想法是:
/image/gallery/category-a8/imagename-i6282.jpg
In this way I have two 301 redirects. 这样,我有两个301重定向。 Is there a better way?
有没有更好的办法?
You can do invisible rewrite to .php
with this .htaccess
: 您可以使用
.htaccess
对.php
无形重写:
RewriteEngine on
RewriteRule ^album_mod/upload/(.+)\.jpg$ /redirect/index.php?file=$1 [L]
And after that you can do only one 301 redirect, with the right new name. 之后,您只能使用正确的新名称执行一次301重定向。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.