wordpress - Redirect request based on user agent -


i need redirect user based on useragent.

currently wordpress site using ajax based theme. url format is

http://www.example.com/#!/my_first_post/ 

my current htaccess code follows.

# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule>  # end wordpress 

this need do:

if (user agent == "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" ){  redirect url without hashes  ex:http://www.example.com/my_first_post/ } 

i need using htaccess. please me.

there's mod_rewrite variable detect user-agents:

rewritecond %{http_user_agent} facebookexternalhit/1\.1 [nc] 

but it's not going you. there no way can match url fragment in htaccess file because fragment is never sent server. url fragments on client side, you're best bet add modifications theme user agent check , have not use fragments if it's facebook.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -