Is there a user-agent or hostname that I can detect in my .htaccess?


#1

I have a single-page application. I’ve got it set up so that when a crawler (ie google) requests a page I render them a compiled version of the webpage. ie a version with all the js executed and DOM updated.

I’m just guessing here but since my twitter card is added to the dom AFTER page load twitters validator won’t be able to detect it.

Is there a user-agent I can capture for the twitter validator? Or does anyone know what URL the validator will be using so I can capture that in my .htaccess?

Thanks,
Billy


#2
I'm just guessing here but since my twitter card is added to the dom AFTER page load twitters validator won't be able to detect it.

Exactly. The current user agent is “Twitterbot/1.0”, so I’d match for “Twitterbot/”.


#3

Thanks “Twitterbot/” works!


#4

Thank you, i have been searching for this