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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.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配置{REQUEST_URI}_Apache_.htaccess - Fatal编程技术网

主页的Apache配置{REQUEST_URI}

主页的Apache配置{REQUEST_URI},apache,.htaccess,Apache,.htaccess,我在aws elastic beanstalk上运行Django站点。我想将www.domain.com/*重定向到domain.com/* 我在httpd.conf中添加了以下内容: RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,L] 结果是: 当我访问www.domain.com/something时,我会被重定向到domain.com/som

我在aws elastic beanstalk上运行Django站点。我想将
www.domain.com/*
重定向到
domain.com/*

我在httpd.conf中添加了以下内容:

  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,L]
结果是:

  • 当我访问
    www.domain.com/something
    时,我会被重定向到
    domain.com/something
  • 但是当我访问
    www.domain.com
    时,我会被重定向到
    domain.com/opt/python/current/app/myapp/myapp/wsgi.py/

如何使其适用于主页?

请添加以下规则,以重定向到主页

<Location />
      RedirectMatch ^/$  /homePage/
</Location>

重定向匹配^/$/主页/

请添加以下规则,该规则将重定向到主页

<Location />
      RedirectMatch ^/$  /homePage/
</Location>

重定向匹配^/$/主页/