Is there such thing as too many permanent 301 redirects?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,153
Reaction score
10,492
So let's say you have a Wordpress site and you change the permalink structure.

Current:

https://site.com/wp-content/uploads/2015/05/bla-yada.jpg (media photos)
https://site.com/blog-posts/ (blog homepage)
https://site.com/asd-bac-ert/ (blog posts)
https://site.com/advertising/ (blog posts categories)
https://site.com/tag/123/ (jobs tags)
https://site.com/jobs/category-name/bla-bla-yada-yada (jobs)
https://site.com/category/advertising/ (jobs categories)


New:

https://site.com/wp-content/uploads/2022/08/bla-yada.png (media photos)
https://site.com/blog/ (blog homepage)
https://site.com/asd-bac-ert/ (blog posts)
https://site.com/category/advertising/ (blog posts categories)
https://site.com/tag/123/ (blog posts tags)
https://site.com/tags/123/ (jobs tags)
https://site.com/offers/bla-bla-yada-yada (jobs)
https://site.com/categories/advertising/ (jobs categories)

---

The way I see it, I need to set redirects for the media photos, about 1000 of them :oops:

I need one for blog homepage

I DON'T need to do it for blog posts, because the permalinks remain he same

I need to do it for blog posts categories

I DON'T need to do it for tags, because none of them are indexed anyway

I need to do it for jobs

I need to do it for jobs categories

---

So we're talking about 1,200 permanent 301 redirects in the htaccess file.

Never mind the work I'm gonna have to put in in order to set them all. Is that too much?

Also, anything that can be made better about the new permalinks that I have?
 
Well, after some twisting and turning, I may have a solution for the media files. I found out that Wordpress will date a photo based on the date the blog post it's attached to was published. This is a feature, not a bug :p

So I go on my new site and set the "Published" date for each blog post to be the date when I originally published it on the old site. Then I reupload the photos in each. Wordpress will give them the same permalinks as they have on my old site, and no 301 needed.

But this is only a fraction of my media/photos. Most of them are tied to jobs on the site, and I'm not sure if I can do the same process there. I'll give it a shot...
 
Well shit. Many of the images are indexed like this:

https://i0.wp.com/site.com/wp-content/uploads/2015/05/bla-yada-yada.jpg?fit=684,370&ssl=1
Or this:

https://site.com/wp-content/uploads/2015/05/bla-yada-bla-yada-bla-yada-766x465.jpg
But then on my new sites, they go different:

https://site.com/wp-content/uploads/2022/08/bla-yada-bla-yada-bla-yada-768x435.jpg
So no matter how much I twist and turn and throw hundreds of hours at it, it's going to be a huge torture trying to get the new site to have the same permalinks as the old site.

In fact, it's gonna be impossible for many of the photos, because the new theme has a minimum size requirement for photos that the old theme doesn't, so many of the photos are displayed larger now. Anyway their URL is different, which is what we care about.

And when it comes to 301, it seems that too many 301s will slow the site down:

Answer. There are no limits in using 301 redirects on a site. You can implement more than 100k of 301 redirects without getting any penalty. But: Too many 301 redirects put unnecessary load on the server and reduce speed.

So I don't know. I may have to say fuck SEO, put up my new site as is, do 301 on about 200 offers/categories links, and let google deal with 1,000+ 404 pages from images.

Any advice anyone?
 
So I don't know. I may have to say fuck SEO, put up my new site as is, do 301 on about 200 offers/categories links, and let google deal with 1,000+ 404 pages from images.
I would also have done the same.

I never advocate too many 301's for the same reason.
 
You need to do SQL rewrites for this, not redirects.

Or you can force the thumbnail sizes to fit your old ones, but I feel this won't do the trick either

I don't know how forcing the image sizes to fit my old ones would work, considering my new theme literally won't allow me to upload an image (when creating an offer) that's smaller than certain dimensions. I had to edit many images from the old site to the new, to be able to post them.

And how would SQL rewrites help? You mean to rewrite the URLs for the images to be exactly like my old/indexed ones? That would work, if Google indexed my image as they are in my Media section. But instead they index the image that's displayed on the pages.

They index this - https://i2.wp.com/site.com/wp-content/uploads/2015/06/asd-asd-asd-asd.jpg?resize=220,180&ssl=1
And this - https://digesale.com/wp-content/uploads/2015/06/asd-asd-asd-asd-asd-799x599.png

Not this - https://digesale.com/wp-content/uploads/2015/06/asd-asd-asd-asd-asd.png (and this is the actual full image that I uploaded)

Sometimes they index the full image, but in over 90%+ of cases they index something that's different than the full original image that I uploaded on the site.

From some reading I did, it seems 1000 / 301 redirects aren't all that many. And what I could do is redirect the images from the ones google indexed to my new ones, and then leave that in for a few months until google changes all the old images to new images in their search results. And then remove the redirects from the htacess file. This would drop my redirects down to about 150 permanent ones, which isn't all that many.

---

But then the question becomes, what kind of redirects should I do?

So fine, I locate each image in Google and get the URL that they've indexed. And then I redirect each of them to the URL of same image that's displayed on my site now.

So if Google has this - https://digesale.com/wp-content/uploads/2015/06/asd-asd-asd-asd-asd-799x599.png

And my new page has this - https://digesale.com/wp-content/uploads/2022/08/asd-asd-asd-asd-asd-770x440.jpg

Then I redirect the old one to the new one, and do it like that.


But then, what the hell do I do about these? https://i0.wp.com/digesale.com/wp-content/uploads/2019/05/asd-asd-asd-asd.png?resize=220,180&ssl=1

Can I even 301 redirect these ones? Because they're indexed on a "different domain", sort of. I think some of my images are like that because of Jetpack. The module that makes images smaller or whatever. I think I disabled it at some point, so my older images are mostly like that.

---

I don't know, I'm lost really. No idea what to do about this...

@BlogPro would know what to do, but I'm not seeing him around lately :D

I would also have done the same.

I never advocate too many 301's for the same reason.

Maybe, maybe. But this site is many years old, and if I lose all those images from google, it's like work down the drain.
 
Maybe, maybe. But this site is many years old, and if I lose all those images from google, it's like work down the drain.
I understand your situation.

I always treat my URLs as the single most precious assets. I never play with them too much, unless if it is that necessary.

Anything on the page is editable - text, images, videos, but if the URL is broken, everything is gone.
 
OK, I understand the issue now. I read it wrong at first.

You have to do a partial match redirect here but you have two scenarios

The first one, the i2.wp.com are basically those cached version in Wordpress.com CDN through Jetpack plugin. Those will require a regex match
And then the others with different sizes IN the URl, those will require another regex

I'm not sure which server software are you using, but in case it's apache, here you need to do Rewriterule (in Nginx is slightly different). So here you will need two rewrite rules, one for each type of URL (the jetpack one and the other).

Now you have to see which regex to use. Personally I'm really bad at creating regex expressions. My best catch is ask in stackoverflow or something like that asking for a bit of help here

Basically you need something like this:

Code:
RewriteEngine On
RewriteBase /
RewriteRule (here the regex that fits the old URL)  https://youdomain.com/$1      [R=301,L]

Being $1 (or $2 or $3) the segment where you exactly include the /20XX/XX/file-name

Basically what the regex does is to split your URL in segments.

For example:

This URL: https://i2.wp.com/site.com/wp-content/uploads/2015/06/asd-asd-asd-asd.jpg?resize=220,180&ssl=1

Could be splitted in 4 segments

$1 = https://i2.wp.com/site.com/
$2 = wp-content/uploads/2015/06/
$3 = asd-asd-asd-asd.jpg
$4 = ?resize=220,180&ssl=1

Then you will only need to set your host = https://yoursite.com/ and then the segments you need like https://yoursite.com/$2$3

And you could use a RewriteCond to create a conditional in case it's the first scenario (the Jetpack one or the other one)

For example, for the jetpack one (following my example above)

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^wp\.com [NC]
RewriteRule (here the regex that fits the old URL)  https://youdomain.com/$2$3 [R=301,L]

But as I said, the regex rule could be tricky, and I'm unfortunate at figuring out them. Maybe you could open a Hire a freelancer post asking for such work "Need some regex expressions". This is not supercomplex, for someone with skills on regex, this may not take more than 1 hour to figure it out, so $20-40 will fill this adequately in most cases, this is you want to speed this process up; otherwise, as I said you can open in a development forum your question, and maybe someone could figure it out for you, or maybe someone with better skills than mine on this regard, could do this forum you.

PS: My recommendation is that you provide for each image, 4 or 5 examples of how the old URL look and how the new URL must look, so the regex creator can identify a clear pattern for the whole 5 examples that may work in 100% of the cases.
 
OK, I understand the issue now. I read it wrong at first.

You have to do a partial match redirect here but you have two scenarios

The first one, the i2.wp.com are basically those cached version in Wordpress.com CDN through Jetpack plugin. Those will require a regex match
And then the others with different sizes IN the URl, those will require another regex

I'm not sure which server software are you using, but in case it's apache, here you need to do Rewriterule (in Nginx is slightly different). So here you will need two rewrite rules, one for each type of URL (the jetpack one and the other).

Now you have to see which regex to use. Personally I'm really bad at creating regex expressions. My best catch is ask in stackoverflow or something like that asking for a bit of help here

Basically you need something like this:

Code:
RewriteEngine On
RewriteBase /
RewriteRule (here the regex that fits the old URL)  https://youdomain.com/$1      [R=301,L]

Being $1 (or $2 or $3) the segment where you exactly include the /20XX/XX/file-name

Basically what the regex does is to split your URL in segments.

For example:

This URL: https://i2.wp.com/site.com/wp-content/uploads/2015/06/asd-asd-asd-asd.jpg?resize=220,180&ssl=1

Could be splitted in 4 segments

$1 = https://i2.wp.com/site.com/
$2 = wp-content/uploads/2015/06/
$3 = asd-asd-asd-asd.jpg
$4 = ?resize=220,180&ssl=1

Then you will only need to set your host = https://yoursite.com/ and then the segments you need like https://yoursite.com/$2$3

And you could use a RewriteCond to create a conditional in case it's the first scenario (the Jetpack one or the other one)

For example, for the jetpack one (following my example above)

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^wp\.com [NC]
RewriteRule (here the regex that fits the old URL)  https://youdomain.com/$2$3 [R=301,L]

But as I said, the regex rule could be tricky, and I'm unfortunate at figuring out them. Maybe you could open a Hire a freelancer post asking for such work "Need some regex expressions". This is not supercomplex, for someone with skills on regex, this may not take more than 1 hour to figure it out, so $20-40 will fill this adequately in most cases, this is you want to speed this process up; otherwise, as I said you can open in a development forum your question, and maybe someone could figure it out for you, or maybe someone with better skills than mine on this regard, could do this forum you.

PS: My recommendation is that you provide for each image, 4 or 5 examples of how the old URL look and how the new URL must look, so the regex creator can identify a clear pattern for the whole 5 examples that may work in 100% of the cases.

Sweet, thanks for the reply man.

But, couldn't I go "Dinosaur mode" on it? Is the regex really necessary?

Couldn't I just do it like this in the htaccess file?

RewriteEngine On
Redirect 301 https://site.com/wp-content/uploads/2015/06/asd-asd-asd-asd-asd-799x599.png https://site.com/wp-content/uploads/2022/08/asd-asd-asd-asd-asd-770x440.jpg
Redirect 301 https://site.com/wp-content/uploads/2015/06/mama-755x200.png https://site.com/wp-content/uploads/2022/08/mama-820x350.jpg
Redirect 301 https://site.com/wp-content/uploads/2015/06/lolz-380x380.png https://site.com/wp-content/uploads/2022/08/lol-450x850.jpg

And on and on it goes...

And if I could, I imagine something like the above would (would it?) work for images that were indexed from my site (not the stupid Jetpack Photon thing). But then what do I do about the Jetpack ones? Would this work?

RewriteEngine On
Redirect 301 https://i2.wp.com/site.com/wp-content/uploads/2015/06/asd-asd-asd-asd.jpg?resize=220,180&ssl=1 https://site.com/wp-content/uploads/2022/08/asd-asd-asd-asd-asd-770x440.jpg
Redirect 301 https://i2.wp.com/site.com/wp-content/uploads/2015/06/la-la.jpg?resize=500,400&ssl=1 https://site.com/wp-content/uploads/2022/08/la-la-400x300.jpg
 
So I tried this at the end of my htaccess file:

RewriteEngine On
Redirect 301 https://i0.wp.com/site.com/wp-content/uploads/2019/05/asd-dfg-ert.png?resize=220,180&ssl=1 https://site.com/
Redirect 301 https://site.com/wp-content/uploads/2021/03/asd-sdf-dfg-fgh-ghj-fgh.jpg https://site.com/wp-content/uploads/2015/06/dfg-dfg-sdf-sdf-asd-asd-799x599.png

I deleted cache, and refreshed each URL. They still showed the same image. The redirect didn't happen.

Why didn't it work?

Ok I got it to work for regular pages. But for images it won't work...
 
So I went through like 40 different results on google, and no one gives a working solution to redirect an image, to another image.

This...

RewriteEngine On
Redirect 301 /wp-content/uploads/2021/03/asd-asd.jpg /wp-content/uploads/2021/03/asd-bas.jpg

Doesn't work.

All the results I get to are giving some complicated bullshit. I just wanna redirect an image URL, to another image URL. Why torture me with it? It works for regular pages, why not work for images? What kind of shit is that?

Fucking seo bullshit...
 
Well, I tried, but I can't figure out how to redirect an image to another image. Eh.

Anyway, I changed the URL for the blog homepage, so now that's one less 301 I gotta do.

I'll also run through the blog posts and change the dates on each, and change the images on each, to align with my current site and what's indexed.

And in the end I guess I'll just put up the new site, 301 the jobs and categories, and let google deal with the images.

If anyone can tell me how to fucking redirect "site/image.jpg" to "site/otherimage.png", do tell.
 
Okay, so I contacted a friend to ask what to do, because he would know. But he's going through some hard times right now, so I can't be bothering him with it.

Yesterday I changed the blog homepage URL, so that won't require a 301.

I also edited all 70 blog posts and backdated them, and then reuploaded all the pictures on them. Now all the blog posts and the pictures in them have the same URL, and no 301 will be required.

I'm gonna try to change the category URL for blog posts and jobs, so that the ones for jobs are the same as my current site, and that will save even more 301s.

I still don't know what I'm gonna do about the jobs photos...
 
So for some reason on my current site the blog categories have nothing in the URL to show that it's a category. The site is very old. I'm not sure why it's like this, or how it's like this. When I go to Settings/Permalinks, there's nothing inserted there to make the URLs like that.

This is how they are now:

https://site.com/advertising/ (blog posts categories)

And if you visit a category page, on top the title is "Blog Archives".

But a blog post is like this:

https://site.com/asd-bac-ert/ (blog posts)

So what if I named a blog post the same as a category? They would have the same URL? I bet wordpress would insert a number or something on the new page with the same URL.

Anyway, I don't know. So I'm gonna make the blog categories like this:

https://site.com/blog-category/advertising/

I figure, that's descriptive. And the blog on this site is more or a filler thing than something that ranks or I care about very much, so whatever.

---

I changed the blog categories slug, and I changed the jobs category slugs. Everything seems ok :alien:

Now the job categories have the same slugs as on my existing site, so I don't have to 301 them.

I'm gonna need to 301 the blog categories. There's only 11 of them, so no biggie. I also saved in a file a few mickey mouse pages that will require a 301 (a few pages that exist on the current site, but won't exist on the new one, and a few pages where the URL has changed slightly). Total 18 301s I gotta do so far...

Done and done.

---

All that's left are the stupid jobs images. Somebody sent me a way to 301 them. I'm gonna test it now...
 
When I google site:mysite.com, I have about 250 images in google images. I don't know how many (if any) I have in Bing and Yahoo and other places.

Most of those will be 404 once I change the site. But there is no solution.

I guess maybe I could move the "Uploads" folder where the images are located from the old site in the new site. That way those image URLs will all continue to exist on my domain, and won't result in a 404.

Or maybe I could backdate all 130 of the jobs on the site, and then reupload the images in each again. That way the images would all have the same URL, and most would be saved. But I'm not entirely sure that would work. And even if it does work, doing it would be a colossal pain in the ass...
 
Actually, nothing would help, because the images are displayed in different sizes between the two sites.

Image on existing site (indexed in google):

https://site.com/wp-content/uploads/2015/05/bla-bla-bla-682x349.jpg
The same image on new site:

https://site.com/wp-content/uploads/2022/08/bla-bla-bla-780x440.jpg
Notice the date and dimensions...

Now, even if I did all the annoying stuff to get the image to have the same URL as the existing image:

https://site.com/wp-content/uploads/2015/05/bla-bla-bla-780x440.jpg
...it would still have different dimensions on the page. So the old image would still go to a 404 page.

Stupid wordpress resizing my images and shit. And before that stupid Jetpack Photon changing my images URLs and shit.

And of course stupid htaccess 301 redirect won't work for images. Who's to blame for this now? My host, wordpress, my website theme, a rule in my htaccess file overriding the 301 image redirects I try to implement, or me for being too stupid to make it happen? I don't know...

---

You know, I have an HTML+CSS+PHP site, and here are some images:

https://site.com/images/homebox/facebook.pnghttps://site.com/images/banner/home.pnghttps://site.com/images/one-two-three-four-five.png
Do you know what would happen if I redesigned this site, and wanted to keep the same image URLs? I would just do it. I wouldn't even have to do anything other than reupload the images in the same folder with the same names and extensions. There is nothing on this site to fuck my shit up!!!

Okay, so now my hating has moved from SEO to fucking wordpress. How fucking dare you interfere with my URLs! You have no right! If I upload something and I don't like the image size, you know what I'll do? I'll edit the goddamn post and change the image size myself!

---

Okay, fuck it, it is what it is. Wordpress sucks, grabs you by the balls, steals control from you. We must suffer :p

I'll just move in my new site, and accept the loss of 200 images in google images (and other places) which will now lead to 404 pages.

This is why I work alone. So that no one can take control from me and create a mess. But of course now I have software to fuck me. Anyway, moving on now...
 
So let's say you have a Wordpress site and you change the permalink structure.

Current:

https://site.com/wp-content/uploads/2015/05/bla-yada.jpg (media photos)
https://site.com/blog-posts/ (blog homepage)
https://site.com/asd-bac-ert/ (blog posts)
https://site.com/advertising/ (blog posts categories)
https://site.com/tag/123/ (jobs tags)
https://site.com/jobs/category-name/bla-bla-yada-yada (jobs)
https://site.com/category/advertising/ (jobs categories)


New:

https://site.com/wp-content/uploads/2022/08/bla-yada.png (media photos)
https://site.com/blog/ (blog homepage)
https://site.com/asd-bac-ert/ (blog posts)
https://site.com/category/advertising/ (blog posts categories)
https://site.com/tag/123/ (blog posts tags)
https://site.com/tags/123/ (jobs tags)
https://site.com/offers/bla-bla-yada-yada (jobs)
https://site.com/categories/advertising/ (jobs categories)

---

The way I see it, I need to set redirects for the media photos, about 1000 of them :oops:

I need one for blog homepage

I DON'T need to do it for blog posts, because the permalinks remain he same

I need to do it for blog posts categories

I DON'T need to do it for tags, because none of them are indexed anyway

I need to do it for jobs

I need to do it for jobs categories

---

So we're talking about 1,200 permanent 301 redirects in the htaccess file.

Never mind the work I'm gonna have to put in in order to set them all. Is that too much?

Also, anything that can be made better about the new permalinks that I have?
No-no, just use a plugin for this Much easier that way
 
No-no, just use a plugin for this Much easier that way

So a plugin can do something that I can't do myself in the htaccess file?

If it can, I'm willing to try. But if it can't, then all I'm doing is installing another plugin on a site, unnecessarily.
 
So a plugin can do something that I can't do myself in the htaccess file?

If it can, I'm willing to try. But if it can't, then all I'm doing is installing another plugin on a site, unnecessarily.
You can do it yourself, but like you've said it requires you to redirect 1000s of links. I just did a quick search and found Redirection plugin: try that one and see if it helps. With Wordpress everyone can be done withing CRM this days which is much easier than modyfing .htaccess and stuff
 
Back
Top