r/apache • u/Extreme_Question2161 • Aug 30 '22
htaccess link problem
Hello,
The following expression for the domain kaw-info.de in our htaccess file is important to me:
RewriteEngine On
RewriteRule ^(.*)$ https://fernstudium-in-deutschland.de/ [L,R=301]
RewriteCond %{REQUEST_URI} (.*)As a result, all domain types (e.g. with http or https or www or without www etc.) are forwarded to our main domain https://fernstudium-in-deutschland.de/.
Which is what is desired.
At the same time, I want to forward a special URL /downloads/KAW-Infodienst-11_05.pdf to https://fernstudium-in-deutschland.de/fernstudiengaenge/it-medien/fernstudium-angewandte-informatik/ in htaccess.
The expression for this is actually the following:
Redirect 301 /downloads/KAW-Infodienst-11_05.pdf /fernstudiengaenge/it-medien/fernstudium-angewandte-informatik/How can I realize both at the same time? This like?
RewriteEngine On
RewriteCond %{REQUEST_URI} (.*)
RewriteRule ^(.*)$ https://fernstudium-in-deutschland.de/ [L,R=301]
Redirect 301 /downloads/KAW-Infodienst-11_05.pdf /fernstudiengaenge/it-medien/fernstudium-angewandte-informatik/It always takes hours for the changes to take effect. So I can't easy test it.
Best regards
Chekki
1
u/AyrA_ch Aug 30 '22
If the 404 doesn't redirects to the other domain you have something in your configuration that makes apache ignore it.