1- I need the .htaccess code for this condition If the user clicked on: website1.download OR website2.download It redirects the user depending on his OS for example:
- If on PC, redirect to http://google.com/
- If on Android, redirect to https://play.google.com/store
- If on iOS, redirect to https://www.apple.com/ios/app-store/
2- I've more than one website in my host and I need to create a one .htaccess to all websites in the host, where I can create the .htaccess file?
That is the htaccess codes and it's not working:
<If "req('Host') = 'website1.download' && = 'website2.download'">
# turn on rewrite engine
RewriteEngine on
# only detect smart phone devices if we are not on mobile site
# to prevent redirect looping
RewriteCond %{HTTP_HOST} !^https://google.com/$
# Android
RewriteCond %{HTTP_USER_AGENT} "android" [NC]
# redirect to google play
RewriteRule .? https://play.google.com/store%{REQUEST_URI} [L,R=302]
# iOS
RewriteCond %{HTTP_USER_AGENT} "android" [NC]
# redirect to app store
RewriteRule .? https://www.apple.com/ios/app-store/%{REQUEST_URI} [L,R=302]
</If>