.htaccess - Rewrite Rule from Apache to Nginx -
can me rewriting this? have these rules:
rewritecond %{http_user_agent} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|showyoubot|outbrain|pinterest [nc,or] rewritecond %{query_string} _escaped_fragment_ rewriterule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*) /api/prerender/$2 [p,l]
and need rewritten nginx.
basically, let's assume url
http://example.com/?_escaped_fragment_=/item/123
should rewritten to
http://example.com/api/prerender/?_escaped_fragment_=/item/123
i hope understand.
try:
location / { if ($http_user_agent ~* "baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|showyoubot|outbrain|pinterest") { rewrite ^/(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*) /api/prerender/$2 break; } }
Comments
Post a Comment