doucheng2053 2017-03-04 08:51
浏览 129
已采纳

的.htaccess; 重定向do子目录而不显示在URL中

I have multiple domains like:

www.example.com
www.myexample.com
www.this-is-an-example.com

All domains point to the main path / on my server.

How can I point a single domain to a subdirectory on my server without showing un the URL?

I mean instead of www.myexample.com pointing to / on my server it should point to /myexample/ on my server.

So calling www.myexample.com via browser should open /myexample/index.php on my server and NOT /index.php.

And www.myexample.com/some_path/some_file.php should look for /myexample/some_path/some_file.phpnon my server but the URL should remain www.myexample.com/some_path/some_file.php and get changed to www.myexample.com/myexample/some_path/some_file.php

Does anybody know how to do this? I already tried to Google but without success maybe because I don't really know what to search for.

  • 写回答

2条回答 默认 最新

  • drt96856 2017-03-04 09:30
    关注

    You can use this rule

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.)?myexample\.com$
    RewriteRule !folder /folder%{REQUEST_URI} [L]
    

    This will internally forward www.myexample.com or myexample.com (non-www) with requested uri to /folder

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料