Hi all. I'm trying to implement a redirect based on useragent, but only for a specific folder.
Example:
If the user agent "exampleuseragent" requests:
http://www.mysite.com/folder/
...it should be redirected to:
http://www.mysite.com/folder/index2.html
This is my current .htaccess file. The final 2 lines are the ones trying to make this work.
This htaccess is in the root of the site. I have also tried using a different .htaccess inside the folder, but still can't make it work. Any ideas??
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html|php)$ http://www.mysite.com/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} exampleuseragent
RewriteRule /folder/ http://www.mysite.com/folder/index2.html [R=301,L]
Example:
If the user agent "exampleuseragent" requests:
http://www.mysite.com/folder/
...it should be redirected to:
http://www.mysite.com/folder/index2.html
This is my current .htaccess file. The final 2 lines are the ones trying to make this work.
This htaccess is in the root of the site. I have also tried using a different .htaccess inside the folder, but still can't make it work. Any ideas??
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html|php)$ http://www.mysite.com/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} exampleuseragent
RewriteRule /folder/ http://www.mysite.com/folder/index2.html [R=301,L]