将index.html移动到父文件夹apache

时间:2017-12-22 10:09:47

标签: apache .htaccess

我将我的(Drupal)网站的index.html从一个demo文件夹移动到其父文件夹" htdocs"像这样。但是其他脚本文件和css文件仍保留在同一个演示文件夹中。

在:

  1. 数据/ apache2的/的的htdocs /演示/ index.html中
  2. data / apache2 / htdocs / demo / script.js
  3. 数据/ apache2的/ htdocs中/演示/ style.css中
  4. 后:

    1. 数据/ apache2的/的的htdocs / index.html中
    2. 数据/ apache2的/ htdocs中/演示/的script.js
    3. 数据/ apache2的/ htdocs中/演示/ style.css中
    4.   

      我不确定需要进入httpd.conf或更改的更改   .htaccess文件将index.html移动到其父文件夹中   工作。同时,新规则或别名应该寻找其他规则   demo文件夹中的资源(js,css)。

      的httpd.conf

      <Directory "/data/apache2/htdocs">
          #
          # Possible values for the Options directive are "None", "All",
          # or any combination of:
          #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
          #
          # Note that "MultiViews" must be named *explicitly* --- "Options All"
          # doesn't give it to you.
          #
          # The Options directive is both complicated and important.  Please see
          # http://httpd.apache.org/docs/2.4/mod/core.html#options
          # for more information.
          #
          Options Indexes FollowSymLinks
      
          #
          # AllowOverride controls what directives may be placed in .htaccess files.
          # It can be "All", "None", or any combination of the keywords:
          #   AllowOverride FileInfo AuthConfig Limit
          #
      AllowOverride All
      
          #
          # Controls who can get stuff from this server.
          #
          Require all granted
      </Directory>
      

      .htaccess - &gt;目前在data / apache2 / htdocs文件夹下

      <IfModule mod_rewrite.c>
          Options +FollowSymlinks
        # Options +SymLinksIfOwnerMatch
          RewriteEngine On
        # RewriteBase /
      
        # If an existing asset or directory is requested go to it as it is
          RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
          RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
          RewriteRule ^ - [L]
      
          # If the requested resource doesn't exist, use index.html
           RewriteRule ^ /
      
      </IfModule>
      

0 个答案:

没有答案