Wordpress/htaccess - 允许访问子目录

Wordpress/htaccess - allow access to subdirectory

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

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

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

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

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

但这似乎没有帮助:

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

<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 上查看网站,是否足以清除 phone 上的 safari 历史记录以刷新数据以便它识别新的 .htaccess?谢谢。

更新

我补充了:

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

到在 httpd.confIncludeed 的 .conf 文件,重新启动了 apache,但没有帮助。

我也试过:

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

它没有用,我不确定我是否只需要 AllowOverride All - 不管怎样这似乎都没有帮助。

更新

httpd.confIncluded 的 .conf 文件中,我尝试了:

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

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

但没有用。

有什么理由我不应该在我的服务器上创建另一个子域并从那里托管文件以便访问它们不会与我的 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/

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

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