All posts by skow

htaccess – redirect problems with domain root and subdirectories

I have a domain www.old_domain.de and like to redirect only the startpage to www.new_domain02.de/subdirectory_start.

All the other subdirectories of www.old_domain.de/ (www.old_domain.de/subdirectory01, www.old_domain.de/subdirectory02, etc) should be redirected to www.new_domain.de/subdirectory01, www.new_domain.de/subdirectory02 ...

I like to do this with a htaccess.

My tests didn't work:

RewriteCond %{REQUEST_URI} (.*)
RewriteRule ^(.*)$ https://www.new_domain.de/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^(www\.)?old_domain\.de [NC]
RewriteRule ^(.*)$ https://www.new-domain.de/subdirectory_start [R=301,L] 

Can anyone give me insights in how I get this work? I am a new in using a htaccess.

Thank you.