我在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
文件。
一些帮助将不胜感激=)
谢谢。
答案 0 :(得分:0)
尝试此代码
<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>
注意:在服务器配置中,应将 AllowOverride 设置为全部。 您可以从这里找到参考。 How to Set AllowOverride all