Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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
Wordpress/htaccess-允许访问子目录_Wordpress_Apache_.htaccess_Directory_Subdirectory - Fatal编程技术网

Wordpress/htaccess-允许访问子目录

Wordpress/htaccess-允许访问子目录,wordpress,apache,.htaccess,directory,subdirectory,Wordpress,Apache,.htaccess,Directory,Subdirectory,我有一个子目录(app),我想访问它,它位于我的wordpress站点的根文件夹中。我在这里看过: 我尝试过这些解决方案,但没有任何效果 我还尝试将一个单独的.htaccess文件添加到app子目录,如下所示: DirectoryIndex index.php index.html index.htm Options +Indexes <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQ

我有一个子目录(
app
),我想访问它,它位于我的
wordpress
站点的根文件夹中。我在这里看过:

我尝试过这些解决方案,但没有任何效果

我还尝试将一个单独的
.htaccess
文件添加到
app
子目录,如下所示:

DirectoryIndex index.php index.html index.htm
Options +Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/app/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

# END WordPress
但这似乎没有帮助:

我现在尝试使用的主
.htaccess
如下所示:

DirectoryIndex index.php index.html index.htm
Options +Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/app/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

# END WordPress
对于在
httpd.conf
中获取
Include
ed的.conf文件,重新启动apache,但没有帮助

我还尝试:

<Directory "/home/eamondev/public_html/subconscious/">
    AllowOverride All
</Directory>
但这没用


有什么理由我不应该在我的服务器上创建另一个子域并托管文件,这样访问它们就不会与我的wordpress站点发生冲突吗?

使用下面的代码我认为它会起作用

<IfModule mod_rewrite.c>
RewriteEngine On

# Map http://www.example.com to /app.
RewriteRule ^$ /app/ [L]

# Map http://www.example.com/x to /app/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/app/
RewriteRule ^(.*)$ /app/$1

# Add trailing slash to directories within app
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^app/(.*[^/])$ http://www.example.com/$1/ [R=301]
</IfModule>

重新启动发动机
#地图http://www.example.com 到/应用程序。
重写规则^$/app/[L]
#地图http://www.example.com/x 到/app/x,除非web根目录中有x。
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}^/应用程序/
重写规则^(.*)$/app/$1
#将尾部斜杠添加到应用程序中的目录
#这不会公开内部URL。
重写cond%{SCRIPT_FILENAME}-d
重写规则^app/(.[^/])$http://www.example.com/$1/[R=301]

事实证明,我的域尚未传播,因此无法查看/测试我所做的任何更改。在我意识到它仍在传播之前,我还想创建另一个子域,并从那里托管我需要的文件。

谢谢,有一个问题…这只是取代顶部的
IfModule
还是两者兼而有之?还有什么是
jekyll?
你知道我需要做的就是能够访问wordpress根目录的
app
子目录中的
index.html
,如果它没有将我重定向到404错误?我进行了更改并清除了浏览器中的缓存,然后转到,但它仍然提供404。那么
允许覆盖所有
?还有这一行…
RewriteRule^jekyll/(.*[^/])$http://www.example.com/$1/[R=301]
我需要将
example.com
url更改为
https://subconscious.eamondev.com/$1/