求大佬写条apache rewrite规则
本帖最后由 lanleoean 于 2018-2-3 13:20 编辑aaa.com/watch?v=abc
跳转到
aaa.com/video?url=https://youtu.be/abc
目前的rewrite规则
RewriteEngine On
RewriteCond %{HTTP_HOST} ^alltube\.herokuapp\.com$
RewriteRule ^(.*)$ https://www.alltubedownload.net/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}/$1
搭建了个alltube,想方便点下ytb yc014t
apache的,谢大佬
事后再补500金
成功了,规则如下:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^alltube\.herokuapp\.com$
RewriteRule ^(.*)$ https://www.alltubedownload.net/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/watch(.*)$
RewriteRule ^ index.php
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}/$1
RewriteCond %{QUERY_STRING} ^v=(.*)$
RewriteRule ^watch(.*)$ https://%{SERVER_NAME}/video?url=https://youtu.be/%1
lanleoean 发表于 2018-2-3 11:57
更新了 大佬看下
一个问号那就好搞了
RewriteCond %{QUERY_STRING} ^v=(.*)$
RewriteRule ^watch(.*)$ http://127.0.0.1/video?url=https://youtu.be/%1 tension 发表于 2018-2-3 04:07
RewriteRule /video?url=https://ytb.com/watch?v=(.+) /watch?v=$1
失败了,RewriteRule 好像不会匹配?后面的字符串 Freetion 发表于 2018-2-3 04:11
RewriteRule ^/video?url=https://ytb.com/watch?v=(.*)$ /whatch?v=$1
试试看?
失败了,RewriteRule 好像不会匹配?后面的字符串 本帖最后由 今晚我是你的 于 2018-2-3 10:47 编辑
有2个问号不好搞,还是换nginx?
1个问号的话有个案例
把 /abc?id=123=>/def.php?id=123 的写法:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(.+)$
RewriteRule ^/abc$ /def.php?sid=%1
RewriteRule 不会去匹配 ? 后面的字符串,需要用RewriteCond来匹配 今晚我是你的 发表于 2018-2-3 10:45
有2个问号不好搞,还是换nginx?
1个问号的话有个案例
更新了 大佬看下
页:
[1]
2