Wordpress/htaccess-允许访问子目录 [英] Wordpress/htaccess - allow access to subdirectory

查看:63
本文介绍了Wordpress/htaccess-允许访问子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要访问的子目录( app )位于我的 wordpress 网站的根文件夹中.我看过这里:

I have a subdirectory (app) I want to access that is in the root folder of my wordpress site. I have looked here:

https://wordpress.stackexchange.com/questions/20152/cannot-access-non-wordpress-subdirectories-as-wordpress-overrides-them-with-a-40

我尝试了解决方案,但没有任何效果.

I have tried the solutions and nothing worked.

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

I also tried adding a separate .htaccess file to the app subdirectory that looks like this:

DirectoryIndex index.php index.html index.htm
Options +Indexes

但这似乎没有帮助:

我正在尝试的主要 .htaccess 看起来像这样:

The main .htaccess I am trying with now looks like this:

<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

我收到 404 错误.

我做错了什么?如果我正在iPhone上浏览网站,是否清除手机上的野生动物园历史记录足以刷新数据,以便它可以识别新的.htaccess?谢谢.

What am I doing wrong? If I am viewing the site on an iPhone, is clearing the safari history on the phone enough to refresh the data so it recognizes the new .htaccess? Thanks.

更新

我添加了:

<Directory "/home/eamondev/public_html/subconscious/">
    Options All
    AllowOverride All
    Require all granted
</Directory>

到.conf文件,该文件在 httpd.conf 中得到 Include ,重新启动apache,但无济于事.

to a .conf file that gets Includeed in httpd.conf, restarted apache, but didn't help.

我也尝试过:

<Directory "/home/eamondev/public_html/subconscious/">
    AllowOverride All
</Directory>

并且它不起作用,我不确定是否只需要 AllowOverride All -两种方法似乎都无济于事.

and it didn't work, I'm not sure if I only need AllowOverride All - either way this doesn't seem to help.

更新

httpd.conf 中包含 Include 的.conf文件中,我尝试过:

In a .conf file that is Included in httpd.conf, I tried:

<VirtualHost 162.241.180.99:80>
    ServerName eamondev.com
    DocumentRoot /home/eamondev/public_html

    <Directory "/home/eamondev/public_html/">
      AllowOverride All
    </Directory>
</VirtualHost>

但这没有帮助.

是否有任何理由我不应该仅在服务器上创建另一个子域并将文件托管在该服务器上,以使到达它们不会与我的wordpress网站冲突?

Is there any reason I shouldn't just make another subdomain on my server and host the files out of there so reaching them doesn't conflict with my wordpress site?

推荐答案

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

Turns out, my domain hadn't propagated yet, so it wasn't possible to see/test any of the changes I was making. Before I realized that it was still propagating, I also thought to just create another subdomain and host the files I needed to from there.

这篇关于Wordpress/htaccess-允许访问子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆