【问题标题】:Internal server url redirecion内部服务器 url 重定向
【发布时间】:2012-12-09 06:54:27
【问题描述】:

关注How to re-write timthumb.php image url? 我能够在我的 nginx Web 服务器中创建重定向。

不过,我想保留原来的网址。

因此,如果访问者获得 URL http://mydomain.com/thumb/120/120/image.jpg,它不会将浏览器重定向到 http://mydomain.com/timthumb.php/?s=image.jpg&h=120&w=120,而是会在同一链接下显示图像。

这种(服务器内部)重定向可能吗? 谢谢...

【问题讨论】:

    标签: php url-rewriting nginx


    【解决方案1】:

    无法在我的服务器上对其进行测试,但它必须或多或少等于您的 nginx 站点 conf 中的此类代码。修改配置后别忘了重启nginx。

    Location /thumb/ {
        rewrite ^/thumb/(\d+)/(\d+)/(.*)\..*$ /timthumb.php/?s=$3&h=$2&w=$1 last;
    }
    

    【讨论】:

    • 为了让它工作,我必须将我的 nginx 配置文件更改为: location ~* ^/thumb/([0-9]+)/([0-9]+)/( .*)$ { 重写 ^/thumb/(\d+)/(\d+)/(.*)$ /timthumb.php?src=http://$host/$3&zc=1&w=$1&h=$2 最后; } Anwyay...非常感谢您的提示!它节省了我的时间... ;)
    猜你喜欢
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-11
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    • 2021-03-15
    相关资源
    最近更新 更多