Redirecting domains, from 301 to a 302 to a 200 - http-status-code-301

So did some checking (https://httpstatus.io/) and noticed that some of my domain are redirecting from a 301 to a 200 (what we want) and a couple of them are redirecting from a 301 to a 302 to a 200. All redirects are permanetly. Is this bad in some way ?

Related

.htaccess Redirect 301 Strange behaviour

I have a new Website that consists of 1 Domain and 2 Subdomains:
Domain:
www.bluepuma.at
Subdomain:
werbeagentur.bluepuma.at
werbetechnik.bluepuma.at
The old website only had 1 Domain: www.bluepuma.at
Now I wrote a bunch of Redirects to redirect the old directorys from the old website to the new one:
I wrote them in the .htaccess which is in the root domain directory in www.bluepuma.at:
Redirect 301 /werbeagentur-bluepuma/wer-ist-bluepuma/ https://werbeagentur.bluepuma.at/
Redirect 301 /werbeagentur-bluepuma/jobs/ https://werbetechnik.bluepuma.at/werbetechnik/jobs-lienz
Redirect 301 /agentur/online-marketing/suchmaschinenoptimierung/ https://werbeagentur.bluepuma.at/online-werbung/online-marketing
Redirect 301 /agentur/online-marketing/suchmaschinenmarketing/ https://werbeagentur.bluepuma.at/online-werbung/online-marketing
Redirect 301 /agentur/online-marketing/social-media-marketing/ https://werbeagentur.bluepuma.at/online-werbung/social-media-marketing
Redirect 301 /agentur/online-marketing/newsletter-marketing/ https://werbeagentur.bluepuma.at/online-werbung/online-marketing
Redirect 301 /agentur/online-marketing/videomarketing/ https://werbeagentur.bluepuma.at/online-werbung/produktfotografie
Redirect 301 /agentur/online-marketing/analyse-controlling-reporting/ https://werbeagentur.bluepuma.at/online-werbung/online-marketing
Redirect 301 /agentur/online-marketing/marketing-konzepte-planung/ https://werbeagentur.bluepuma.at/online-werbung/online-marketing
Redirect 301 /agentur/online-marketing/ https://werbeagentur.bluepuma.at/online-werbung/online-
Now I have the problem, that the Redirect also work on the Subdomain:
Example:
If I open https://werbeagentur.bluepuma.at/werbeagentur-bluepuma/wer-ist-bluepuma/
I get redirected to https://werbeagentur.bluepuma.at/ according to this redirect statement:
Redirect 301 /werbeagentur-bluepuma/wer-ist-bluepuma/ https://werbeagentur.bluepuma.at/
But this should not be possible.
The Redirects should only affect the main domain. For example:
www.bluepuma.at/werbeagentur-bluepuma/wer-ist-bluepuma/ should get redirected to https://werbeagentur.bluepuma.at/
Do you have any ideas why this could be?
Another strange behaviour: If I open
www.bluepuma.at/agentur/online-marketing/suchmaschinenoptimierung/
I get to the page
https://werbeagentur.bluepuma.at/online-werbung/online-marketingsuchmaschinenoptimierung/
I have no idea what causes this error.
Thanks for your answer and your time!

Problem with path 301 redirects in htaccess

We're trying to redirect a bunch of category URLs like this:
Redirect 301 /table/ https://www.example.com/abc/
Redirect 301 /table/accessoires/ https://www.example.com/def/
Redirect 301 /table/accessoires/tablecloth/ https://www.example.com/ghj/
The first redirect works correctly. But why do the other 2 don't work?
Order matters. The more specific rules should be first.
Redirect 301 /table/accessoires/tablecloth/ https://www.example.com/ghj/
Redirect 301 /table/accessoires/ https://www.example.com/def
Redirect 301 /table/ https://www.example.com/abc/

301 Redirect not working in some cases

I've made a few changes to my URL structure. Here is my htaccess file
Redirect 301 /top100 http://www.example.com
Redirect 301 /monthlytop10 http://www.example.com/monthlytop
Redirect 301 /top100/Hardwell http://www.example.com/top100/hardwell
Redirect 301 /top100/Armin%20van%20Buuren http://www.example.com/top100/armin-van-buuren
Redirect 301 /top100/David%20Guetta http://www.example.com/top100/david-guetta
This works for the first 2 cases but doesn't work for the rest. It redirects www.example.com/top100/Armin%20van%20Buuren to www.example.com/Armin%20van%20Buuren
If I remove the first line in the htaccess file, it doesn't redirect at all and gives a 404 error. What's wrong here?
That is because Redirect directive doesn't support regex. Use RedirectMatch instead to match exactly what you want:
RedirectMatch 302 "^/top100/?$" /
RedirectMatch 302 "^/monthlytop10/?$" /monthlytop
RedirectMatch 302 "^/top100/Hardwell/?$" /top100/hardwell
RedirectMatch 302 "^/top100/Armin van Buuren/?$" /top100/armin-van-buuren
RedirectMatch 302 "^/top100/David Guetta/?$" /top100/david-guetta

htaccess: Redirect vs. Redirect 301

I was just looking in one of my .htaccess files and noticed the following:
Redirect /old-page /new-page
I was expecting to see Redirect 301 or Redirect 302, but it only said Redirect and works just fine.
I'm curios if 301 or 302 isn't indicated what does the redirect default to? 301? 302? Something else?
This line:
Redirect /old-page /new-page
Means use 302 since 302 is default value here.
To use 301:
Redirect 301 /old-page /new-page
See 301 directive documentation

how to create 301 redirection for all pages except robots.txt

I have just changed my domain mydomain.com to clientdomain.com. I have created 301 rediction useing
Redirect 301 / http://cleintdomain.com/
Everything works good. But I don't want to redirect http://mydomain.com/robots.txt. How can I exclude robots.txt from redirect condition?

Resources