开发者

Redirect on the basis of referer HTTP_REFERER htaccess

I've an issue where i want to redirect a user on the basis of a substring from referered url, How i can accomplish that using htaccess?

  1. User is on http://example.com/aqeel/videos/
  2. There is a hyperlink on the above page http://demo.开发者_JAVA技巧example.com/
  3. When user reaches http://demo.example.com/, I want him to be redirected to http://demo.example.com/login/aqeel/, Here aqeel is the substring captured from the referer url in htaccess from step 1 URL.

Thanks in Advance,


You can use below code to make that work:

RewriteCond %{HTTP_REFERER} http\:\/\/example.com/([a-z]+)/videos/
RewriteRule (.*)$ /login/%1/

I tried on my domain.. and it works... hope that too work with you... :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜