Forum Moderators: phranque
I have an entire domain with hundreds of html pages. I wish to redirect any and all Spanish visitors to a single ad page on a different domain.
I don't want to have to add any code to each html page, but instead would prefer to globally redirect anyone who has their language preference set to Spanish.
Can anyone help me out with the htaccess entries. I have read over a number of reference sources..but the whole thing still confuses me somewhat.
For a different domain, and a separate project, I again wish to redirect any and all visitors, but this time, only if the surfer is using an AOL browser.
Thanks for any help you can throw my way!
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^AOL
RewriteRule ^.*$ [new...] site where I want all aol traffic to be redirected to [L,R]
I was looking through my own log files to find an example of an AOL browser, but i didn't find a single one (the site is not from the US, not even in english). As i recall, the browser name ("User Agent string") does not start with AOL, rather it has AOL somewhere in it.
When you write this:
RewriteCond %{HTTP_USER_AGENT} ^AOL
-you state that the string should start with AOL. Remove the ^ character and it will be true no matter where in the string the AOL is located.
Regarding language: I'd like to know too. I know it can be done, as i recently had a project where it was done, but i did not code it.
/claus
I just found it, but it seems okay.
/claus
Here's what I tried (I used www.msn.com as my test redirect site).
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} AOL
RewriteRule ^.*$ [msn.com...] [L,R]
Here's the response I received, testing it with Netscape and IE:
Forbidden
You don't have permission to access / on this server.
Apache/1.3.27 Server at www.mydomain.com Port 80
I tried setting permissions on my htaccess file to 744, but same thing. I didn't add any other files...I've heard mention of a mod file. Am I missing something, like a mod file?
Thanks!
Do you have access to your raw server error log file? If so, check and see why this failed.
You also might want to try adding the following line ahead of RewriteEngine on:
Options +FollowSymLinks
There is nothing intrinsically wrong with your code - it should have worked. If the above does not help, then there's something weird going on with your server.
Jim
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} AOL
RewriteRule ^.*$ [msn.com...] [L,R]
I tried the followng to redirect all Spanish traffic,but this did not work:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_ACCEPT_LANGUAGE} es
RewriteRule ^.*$ [msn.com...] [L,R]
Any suggestions?
Thanks again for all the help.
Are lines one and three the same on this test page [bowiesnyder.com]?
(for one of the spanish browsers that is.)
/claus
You can also check your browser's request headers [searchengineworld.com] to make sure it is sending the "accept" headers you expect.
Jim