需要使用.htaccess规则转发网址以下的帮助
https://www.example.com/watch?v=yzwRsQ7rR-o
转发到
https://www.example.com/?url=https://www.youtube.com/watch?v=yzwRsQ7rR-o
我遵守现有规则
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
答案 0 :(得分:1)
使用查询字符串检查此重定向
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^watch
RewriteCond %{QUERY_STRING} v=([A-Za-z0-9-]+) [NC]
RewriteRule (.*) /?url=https://www.youtube.com/watch?v=$1 [R=301,L]
</IfModule>