Why does this redirect not work? - .htaccess

I am trying to redirect this directory power-supply-direct to this page /power-supply-direct
I am using this
RedirectMatch 301 ^/power-supply-direct(.*)$ https://www.example.com/power-supply-direct
in htaccess. If I type in /power-supply-direct/sdfasdafs it will redirect properly. But the actual page I am trying to redirect
/power-supply-direct/?___store=english/ProductList.aspx%253FCategoryID=5797
Will not redirect. What am I missing?

Related

301 Redirection for any url in my website

I need to create a 301 redirection from myOldSite.com to myNewSite.com
I have this code in the htaccess in myOldSite.com
#Redirect 301 / https://myNewSite.com/myPage/
This works fine to redirect myOldSite.com but it does not work to fire the right redirection for myOldSite.com/services.html:
myOldSite.com is properly redirected to myNewSite.com/myPage
But
myOldSite.com/services is redirected to myNewSite.com/myPage/services.html This is wrong.
As you can see servicesis appended to the end. This is not what I need. I need:
myOldSite.com/services to be redirected to myNewSite.com/myPage
Any url which start with myOldSite.com/ANYTHING_HERE should be redirected to myNewSite.com/myPage
Use RedirectMatch
RedirectMatch 301 / https://myNewSite.com/myPage
This will not append the old URL subpath to the destination URL.

301 Redirect just first Subfolder

I have a 301 Redirect from one page to another
REDIRECT 301 /cloud-computing /it-infrastructure/cloud-computing
Now when i use this redirect also the subpages of cloud-computing are affected by this 301 redirect, but they have to be redirected somewhere else. How can i just redirect the folder and not the subpages?
You should be using RedirectMatch for precise matching using regex:
RedirectMatch 301 ^/cloud-computing/?$ /it-infrastructure/cloud-computing
Clear your browser cache before testing the change.

301 redirects in .htaccess forming incorrect redirect

I'm trying to redirect http://brisbaneamazingrace.com.au/details.html to http://www.teambonding.com.au/activities/amazing-race-brisbane which is a different domain. In my .htaccess file I have
Redirect 301 http://brisbaneamazingrace.com.au/details.html http://www.teambonding.com.au/activities/amazing-race-brisbane
But the redirect goes to http://teambonding.com.au/activities/amazing-race-brisbanedetails.html
It keeps adding the details.html to the end of the redirect url. Whats up with that?
You should use RedirectMatch for regex matching:
RedirectMatxh 301 ^/details\.html$ http://www.teambonding.com.au/activities/amazing-race-brisbane
Also test this after clearing your browser cache.

Using .htaccess to redirect to a subfolder

I'm trying to 301 redirect from '/en' or '/en/' to '/en/home' using .htaccess, but any attempt I do results into a redirection loop '/en/home/home/home/home/home/home...'.Shouldn't it be as simple as Redirect 301 /en /en/home?
Redirect based rule keep matching /en in redirected URL as well. You can use RedirectMatch for this with regex support:
RedirectMatch 301 ^/(en)/?$ /$1/home
Also make sure to clear your browser cache when you test this.
You have to use the full URL, example:
redirect 301 /folder_wrong/name.html http://website.com/folder-right/name.html

Magento 301 htacess redirect not working at all

i am writing a 301 redirects via htaccess redirect old traffic to new urls
ex
i have old url
http://www.thebedroom.com.au/catalogue/accessories/product134
i need to redirect this request to
http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
so i wrote a code on magento httpacess like below
Redirect 301 http://www.thebedroom.com.au/catalogue/accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
no luck
and also tried
Redirect 301 ^accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
but this not redirectoring and show the same url on browser window.
anyone know what is the issue here
thank you
Try:
Redirect 301 /catalogue/accessories/product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
or
RedirectMatch 301 product134 http://www.thebedroom.com.au/melbourne-demons-bean-bag-cover.html
which will redirect if there's any instance of product134 in the URI.

Resources