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
.htaccess htaccess重定向到子目录并隐藏它_.htaccess_Url Rewriting - Fatal编程技术网

.htaccess htaccess重定向到子目录并隐藏它

.htaccess htaccess重定向到子目录并隐藏它,.htaccess,url-rewriting,.htaccess,Url Rewriting,我已经为此挣扎了一段时间 我的应用程序结构如下: - webroot - app - index.php - .htaccess 我希望当有人转到webrootwww.example.com时,会被重定向到应用程序启动的应用程序文件夹。但是,我希望URL是www.example.com,而不是www.example.com/app/ 我想我需要两个人?一个在webroot中,一个在app中 目前,/app/.htaccess看起来像: RewriteEngine

我已经为此挣扎了一段时间

我的应用程序结构如下:

- webroot
    - app
      - index.php
      - .htaccess
我希望当有人转到webroot
www.example.com
时,会被重定向到应用程序启动的应用程序文件夹。但是,我希望URL是
www.example.com
,而不是
www.example.com/app/

我想我需要两个人?一个在webroot中,一个在app中

目前,
/app/.htaccess
看起来像:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

这会从URL中隐藏
.index.php
文件。

使用以下行在webroot中再创建一个.htaccess

RewriteEngine on
RewriteBase /

RewriteRule !^app/ /app%{REQUEST_URI}