我无法解决这个问题。我需要重定向这种urls:
http://www.example.com/oscthumb.php?src=/images/image.jpg
或
http://www.example.com/oscthumb.php?src=/images/image.jpg&w=150&h=131.8125&f=jpg&q=95&hash=317ec2edb3fa82e56787a5f3308d5e96
至
http://www.example.com/images/image.jpg
不带参数。Image.jpg可能有所不同
如何在.htaccess
中做到这一点
我试过了,但它不能正常工作:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/oscthumb\.php$
RewriteCond %{QUERY_STRING} ^src=(.*)$
RewriteRule ^(.*)$ http://example.com/%1 [R=301,L]
发布于 2018-10-25 02:55:17
尝试使用以下代码:
$url = $_GET['src'];
header('Location: http://www.example.com/' . $url);
exit;
编辑: .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} \.jpg
RewriteRule =([^=]+\.jpg) http://example.com$1 [R=301,L]
https://stackoverflow.com/questions/52976004
复制相似问题