2016-11-16 27 views
2

我不是htaccess的专家,但想重定向,但似乎不像我所期望的那样工作。Skype用户代理重定向

我有以下规则:

RewriteCond %{HTTP_USER_AGENT} (SkypeUriPreview) 
RewriteRule ^(.*)$ http://blog.yuppi.com.ua/server/crawler_proxy/routee.php?path=%1 [NC,L] 

而且我想这个要求 http://blog.yuppi.com.ua/share/post/one-two-three

重定向到http://blog.yuppi.com.ua/server/crawler_proxy/routee.php?path=/share/post/one-two-three

相反,我收到

http://blog.yuppi.com.ua/server/crawler_proxy/routee.php?path=SkypeUriPreview

回答

1

在您的RewriteCond中,(SkypeUriPreview)将在%1中捕获SkypeUriPreview。 在RewriteRule,(.*)将捕获到$1的路径。有关更多视觉示例,请参阅here

在您的规则,与$1替换%1

RewriteCond %{HTTP_USER_AGENT} (SkypeUriPreview) 
RewriteRule ^(.*)$ http://blog.yuppi.com.ua/server/crawler_proxy/routee.php?path=$1 [NC,L]