【问题标题】:Redirect URL without change domain在不更改域的情况下重定向 URL
【发布时间】:2013-08-11 09:01:15
【问题描述】:

我有一台 IP 地址为w.x.y.z 的服务器,并在其上停放了 2 个域。

mydomain.com

herdomain.com

我也有 3 个文件管理器 (php autoindex free) 像这样:

mydomain.com/Files/index.php?dir=folder1/folder2/

herdomain.com/myfiles/index.php?dir=mydata/folder2/

现在我想将打开folder2(来自上述网址之一)的用户重定向到此网址而不更改域(是否可能)?

w.x.y.z/support/index.php?dir=mainfolder/folder2/

如何在 autoindex 或 .htaccess 上执行此操作?

谢谢

【问题讨论】:

    标签: .htaccess url redirect url-rewriting


    【解决方案1】:

    将此添加到您的网络根目录“/”中的.htaccess

    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^(mydomain|heredomain)\.com$ [NC]
    RewriteCond %{QUERY_STRING} dir=(folder1|mydata)/folder2/ [NC]
    RewriteRule ^(.*)$ http://w.x.y.z/support/index.php?dir=mainfolder/folder2/ [L]
    

    【讨论】:

    • @PashaAleayoob 很高兴为您提供帮助。为问题 +1。
    猜你喜欢
    • 1970-01-01
    • 2012-05-22
    • 1970-01-01
    • 2017-02-16
    • 1970-01-01
    • 1970-01-01
    • 2013-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多