.htaccess问题:索引为404


.htaccess Issue : 404 for index

这是我在sub-folder中的.htaccess文件。。。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index'.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>

我想让index.php将mydomain.com/sub-folder/string处理为mydomain.com/sub-folder/?id=string

但我得了404…不知道为什么。这是我的根.htaccess

# 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

将root.htaccess保留为:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(index'.php|sub-folder(/.*)?)$ - [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
# END WordPress

并将其保存在/sub-folder/.htaccess:中

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-folder/
RewriteRule ^index'.php$ - [L,NC]
RewriteRule (.+) index.php?id=$1 [L,QSA]
</IfModule>