url 由 RewriteRule 给出 url 中的变量请求 "file" 而不是 RewriteRule 中的文件

url given by RewriteRule with variable request "file" in url instead of file in RewriteRule

老实说,我是 htaccess 的新手,我的问题是当我想访问 link 时,在使用带有变量的 htaccess rewriterule 时,它​​给了我一个 404 错误,因为它想访问将变量作为文件而不是 htaccess 中给定的文件:

link 看起来像这样: 例如。com/folder/variable

在 htaccess 中它看起来像这样:

RewriteEngine on
Options -Indexes -MultiViews
Order Allow,Deny
Allow from all
Satisfy any
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^folder/([0-9a-z-A-Z-_]+)/$ folder/file.php?title= [NC,QSA,L]

理论上它应该有效,因为它有效,但对我来说它没有。 我试着重写这段代码“几次”,为其他人使用了大量的工作代码,使我的工作没有任何运气。 在我的 httdp.conf 文件中,我将 AllowOverride None 更改为 AllowOverride All,我还检查了 rewrite_module 是否处于活动状态,并且它是并且在没有变量的情况下运行良好。 还有一个 htaccess 文件,满足我文件夹中的任何代码。

我希望我(我们)可以解决我代码中的这个错误。 感谢您日后的帮助和抽出宝贵时间!

发现错误,这是正确的行(/之前 $ 使它不起作用):

RewriteRule ^folder/([0-9a-z-A-Z-_]+)$ folder/file.php?title= [NC,QSA,L]