How to redirect an url in .htaccess when "redirect 301" doesnt work
-
I have an odd page url, generated by a link from an external website, it has:
%5Cu0026size=27.4KB%5Cu0026p=dell%20printers%20uk%5Cu0026oid=333302b6be58eaa914fbc7de45b23926%5Cu0026ni=21%5Cu0026no=24%5Cu0026tab=organic%5Cu0026sigi=11p3eqh65%5Cu0026tt=Dell%205210n%20A4%20Mono%20Laser%20Printer%20from%20Printer%20Experts%5Cu0026u=fb
,after a .jpg image url, and I can't get it redirect using the redirect 301 in .htaccess to the properly image url as I use to do with the rest of not found urls
eg: /15985.jpg%5Cu0026size=27.4KB%5Cu0026p=dell%20printers%20uk%5Cu0026oid=333302b6be58eaa914fbc7de45b23926%5Cu0026ni=21%5Cu0026no=24%5Cu0026tab=organic%5Cu0026sigi=11p3eqh65%5Cu0026tt=Dell%205210n%20A4%20Mono%20Laser%20Printer%20from%20Printer%20Experts%5Cu0026u=fb
to just: /15985.jpg
-
Sorry, I should have clarified. The redirect needs the full path of the image. The actual redirect would be something Ike:
Redirect 301 /images/15985.jpg(.*) /images/15985.jog
depending on where the image actually lives.
-
Sorry, I couldn't get it redirected with this, this is a really naughty url coming from an external website,
but thanks for suggestion -
Have you tried:
redirect 301 15985.jpg(.*) 15985.jpg
This should capture every string that starts with the image name.
Hope that helps.
-
There's a few different methods of doing a redirect or a rewrite which might work. What code are you trying to use for the 301?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
After 301 redirect
hello i do after 301 redirect from old domain to new since 3 month ago my qa : should i replace the backlinks links to new doamin Or the he backlinks in the old link will works
Intermediate & Advanced SEO | | cristophare790 -
Htaccess - Redirecting TAG or Category pages
Hello Fellow Moz's, We have an issue redirecting some /TAG and /Category pages to inner pages. As an example we use: RedirectMatch 301 /category/Sample-Category(.*) https://OurDomain.com.au/New-Page//$1 That works well. The issue is we have other categories and tags that are named similar to /Sample-Category As an example, if we try to redirect /Sample-Category-1 to /New-Page-1 - it will not work, and redirects to /New-Page I assume this is because /Sample-Category is already being redirected, so anything after /Sample-Category like -1 or -2 or -3 etc, will not be recognized. Anyone know of a workaround?
Intermediate & Advanced SEO | | Jes-Extender-Australia0 -
Google ranking 301 redirected vanity urls
We use vanity URLs for offline marketing. An example vanity URL would be www.clientsite.com/promotion, this URL 301 redirects to a page on the site with tracking parameter ex: www.clientsite.com/mainpage?utm_source=source&utm_medium=print&utm_campaign=xyz. We are running into issues with Google ignoring the 301 redirect and ranking these vanity URLs instead of the actual page on the website. Any suggestions on how to resolve?
Intermediate & Advanced SEO | | digitalhound0 -
Effect Of Restoring Old Website After Implementing 301 Redirects
After redesigning my old Drupal website and launching a new "improved" Wordpress version the new version is performing badly. Ranking is poor and conversions don't occur. I realize that my new design is bad (no call to action, poor structure, text heavy). New business inquiries have ceased. The site contains 450 pages. After spending $25,000 and a year of my life I see the new version is not an improvement! What would be the effect of reinstating the old version of the site and doing 301 redirects back to it? Would the old rankings be restored? I need to decide whether I should revert or focus on fixing flaws in the improved design. Any thoughts?? Thanks,
Intermediate & Advanced SEO | | Kingalan1
Alan0 -
301 redirect to multiple domain
Hi guys, I have a domain A, B and C. The domain A was an association of two business and they are about to split. Parts of domain A are going to be redirect to domain B, but some content belong to the domain C. So my question : Is it possible to 301 redirect some pages from A to B and some other pages from A to C and if yes, what would be the impact on SEO ? Thanks a lot!
Intermediate & Advanced SEO | | StevePatenaude0 -
Redirecting, then redirecting back
Hey, mozzers! My first question ever... I have a client who has (fictitionally) WickerPatioHomeStore.com, which features wicker home decor. Not too long ago, they wanted a shorter, easier URL, so they redirected to another domain they own, WickerPatio.com (again, fictional). They saw somewhat of a drop in traffic, and wonder if there's a correlation with the words "home store" not being in their domain any more. When considering the two, I figure that relevant factors would be age of domains, history of content of the domains, and inbound links to each domain. Any thoughts on other things to consider? Thanks very much!! ~ Scott
Intermediate & Advanced SEO | | GRIP-SEO0 -
Automatic redirect to external urls
Hi, there is a way to create a "bridge page" with automatic url redirect ( 302 ) without google penalization? In this moment, my bridge pages are indexed on google with title and description of the redirected page.. Thanks in advance. Mauro.
Intermediate & Advanced SEO | | raulo790 -
Setting up of 301 redirects
Good morning all, As part of the analysis of our website, we have realised that we are diluting our keyword strength in a particular area by having multiple zones all targeting the same keyword. We have decided to combine these zones into one, and set up 301 redirects so that the remaining zone gets the benefit of the other zones' link juice. When setting up a 301 redirect from zone "X" to zone "Y" say, do I need to keep all of the content in zone X, or should I remove all content before the redirect is set up? Does zone Y still get the benefit of zone X's link juice if the content is removed? Many thanks Guy
Intermediate & Advanced SEO | | Horizon0