I'd like to redirect www.example.com/dir/subdir/ to www.example.com but when I put the following in .htaccess:
Redirect 301 /dir/subdir/ https://www.example.com
then www.example.com/dir/subdir/ redirects to www.example.com/dir/
Help appreciated.
Related
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!
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/
How do I correctly redirect this url permanently,
https://example.com/%7Chttps://example.com/
to,
https://example.com
in htaccess?
Thank you!
Redirect 301 <src_url> <dst_url>
So, in your case:
Redirect 301 /|example.com example.com
I want to redirect just the root of my site www.example.com to www.example2.com
but not the subfolders www.example.com/subfolder !
Is it possible?
E.G.
the following rule redirect all my site:
Redirect 301 / http://www.example2.com
To redirect just the root, you can use the following
RedirectMatch 301 ^/$ http://example2.com/
How to redirect as:
Redirect 301 /ruler/ http://www.sample.com/ruler/
Redirect 301 /ruler/red/review http://www.sample.com/product_review/flexible-ruler/
Redirect 301 /ruler/read/ http://www.sample.com/read/soft-ruler/
with above code, it not work correct. with
Redirect 301 /ruler/red/review will to http://www.sample.com/ruler/
Thanks about helps!
You need to put Redirect 301 /ruler/red/review line before Redirect 301 /ruler/, read more about Order of Processing