0

I need to redirect old links to new links. The new links will be a bit different.

For example this (I have marked with capslook on the part that doesn't belong to the post name)

example.com/VIEW-what-ever-dynamic-url-that-changes-RESOLUTION.html

("-RESOLUTION" is something like "-1400x1050" or "-other" etc. )

will redirect to:

example.com/wp-content/show-image.php?path=example.com/wp-content/uploads/what-ever-dynamic-url-that-changes-RESOLUTION.jpg

so notice that "view-" from the old url disappeared, and ".html" was replaced with ".jpg" (the image type)

so if RESOLUTION would be -1400x1050, it would be the same on the new link too.

example.com/VIEW-what-ever-dynamic-url-that-changes-1400x1050.html

example.com/wp-content/show-image.php?path=example.com/wp-content/uploads/what-ever-dynamic-url-that-changes-1400x1050.jpg

exception:

example.com/VIEW-what-ever-dynamic-url-that-changes-RESOLUTION.html if "-RESOLUTION" (if it ends with) "-other" or "-normal", please remove it from the url

example:

example.com/VIEW-what-ever-dynamic-url-that-changes-other.html will redirect to

example.com/wp-content/show-image.php?path=example.com/wp-content/uploads/what-ever-dynamic-url-that-changes.jpg

And

example.com/VIEW-what-ever-dynamic-url-that-changes-normal.html will redirect to

example.com/wp-content/show-image.php?path=example.com/wp-content/uploads/what-ever-dynamic-url-that-changes.jpg

(the links do have "http://www." but I'm not allowed to add it, because of links restriction in this post)

any help?

thank you

1
  • I have this until now, but only the urls that have "example.com/view-" need to be redirected to that url, not all of them. maybe someone could point me in the right direction RewriteEngine on RewriteCond %{HTTP_HOST} ^yourwebsite\.com$ [NC] RewriteRule ^/(.*)-other.html$ http://example.com/wp-content/show-image.php?path=http://example.com/wp-content/uploads/$1.jpg [R=301,L] RewriteRule ^/(.*)-normal.html$ http://example.com/wp-content/show-image.php?path=http://example.com/wp-content/uploads/$1.jpg [R=301,L]
    – vyperlook
    May 29, 2015 at 9:09

1 Answer 1

0

solved it!

RewriteEngine on

# other or normal URL
RewriteRule ^VIEW-(.+?)-(?:other|normal)\.html$ http://example.com/wp-content/show-image.php?path=http://example.com/wp-content/uploads/$1.jpg [R=302,L,NC]

# resolution URL
RewriteRule ^VIEW-(.+?\d+x\d+)\.html$ http://example.com/wp-content/show-image.php?path=http://example.com/wp-content/uploads/$1.jpg [R=302,L,NC]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .