Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使Apache也在浏览器中显示不同的index.html';s地址栏_Apache_.htaccess_Apache Config - Fatal编程技术网

使Apache也在浏览器中显示不同的index.html';s地址栏

使Apache也在浏览器中显示不同的index.html';s地址栏,apache,.htaccess,apache-config,Apache,.htaccess,Apache Config,我的共享主机服务器上有以下文件夹树: www.somesite.com | |_ public_html (document folder) |_ .htaccess (Apache file) |_ index.html (page shown by server now when someone looks for www.somesite.com) | |_ site_editor (folder) | |_login.html (site ed

我的共享主机服务器上有以下文件夹树:

www.somesite.com
|
|_ public_html (document folder)
    |_ .htaccess (Apache file)
    |_ index.html (page shown by server now when someone looks for www.somesite.com)
    |
    |_ site_editor (folder)
    |   |_login.html (site editor control panel)
    |   |_file1.php
    |   |_file2.php
    |   |_ ...
    |
    |_ website (folder)
        |_ index.html (website HOME PAGE)
        |_ page1.html
        |_ page2.html
        |_ etc.
现在,当有人查找www.somesite.com时,Web服务器会在public_html文件夹中查找index.html

  • 当有人查找www.somesite.com时,我希望web服务器显示
    website/index.html
    ,我希望他的浏览器栏只显示
    www.somesite.com/index.html
    ,而不显示
    www.somesite.com/website/index.html

  • 我还希望web服务器在有人查找
    www.somesite.com/site\u editor/
    时显示
    site\u editor/login.html

  • 是否可以通过某些方式设置.htaccess文件来完成这两项任务??


    谢谢

    如果我理解正确,下面的内容应该可以使用,尽管我没有真正测试它:

    RewriteEngine On
    RewriteBase /
    # Rewrite everything that's not site_editor or already rewritten
    # to the website folder
    RewriteRule !^site_editor(/.*)?$ -          [C]
    RewriteRule !^website(/.*)?$     -          [C]
    RewriteRule  ^(.*)$              website/$1 [PT,QSA,L]
    # Rewrite a request to site_editor/ to site_editor/login.html
    RewriteRule  ^site_editor/$      site_editor/login.html
    
    如果人们愿意,他们仍然可以访问www.somesite.com/website/index.html。我认为这可能有一个解决办法,但由于.htaccess重写规则的应用方式,很难做到正确。如果我记得是什么,我会更新我的答案