[英]Wordpress/htaccess - allow access to subdirectory
我有一个子目录 ( app
) 我想访问它,它位于我的wordpress
站点的根文件夹中。 我看过这里:
我已经尝试了解决方案,但没有任何效果。
我还尝试向app
子目录添加一个单独的.htaccess
文件,如下所示:
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 上查看网站,清除手机上的 safari 历史记录是否足以刷新数据以便识别新的 .htaccess? 谢谢。
更新
我补充说:
<Directory "/home/eamondev/public_html/subconscious/">
Options All
AllowOverride All
Require all granted
</Directory>
到Include
在httpd.conf
的 .conf 文件,重新启动 apache,但没有帮助。
我也试过:
<Directory "/home/eamondev/public_html/subconscious/">
AllowOverride All
</Directory>
它没有用,我不确定我是否只需要AllowOverride All
- 无论哪种方式,这似乎都无济于事。
更新
在httpd.conf
Include
d 的 .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/$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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.