我有一个托管在AWS上的WordPress网站,我很难配置mod_rewrite
才能正常工作。
文件夹结构
/root
|_ staging/
|_ live/
.htaccess
是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>
主要问题
我可以访问我用来访问它/staging/index.php/api
而没有像这样---.com/api
这样的子目录。
当我尝试/staging/api
时,它显示File not found
.
我试图将.htaccess
更改为不同的东西,但没有一个成功。
根目录中没有.htaccess
文件。
一些帮助将不胜感激=(
提前谢谢。
试试这段代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /staging
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /staging/index.php [L]
</IfModule>
注意:在服务器配置中,">允许覆盖"应设置为"全部"。您可以从此处找到参考资料。如何设置允许覆盖所有