我不知道为什么,但这个简单的规则不起作用。
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^rubbellos'.png/$ rubbellos/rubbelbild_png.php [NC,L]
RewriteRule ^rubbellos'.css/$ rubbellos/rubbellos_css.php [NC,L]
</IfModule>
如果我将xyz/rupellos/rupelbild_png.php复制到浏览器,那就可以了。
我的方法是将rubelos.png的请求带到.php文件中。但我得到了一个找不到的文件。
谢谢你事先的任何提示。
您有两个错误:
- 使用
RewriteBase
,因为您在问题中谈论的是子目录/xyz/
- 禁用
MultiViews
选项以避免rubbellos
(虚拟文件和现有目录)出现意外行为
您可以在htaccess(必须在/xyz/
文件夹中)中用此代码替换当前代码
Options -MultiViews
RewriteEngine On
RewriteBase /xyz/
RewriteRule ^rubbellos'.png$ rubbellos/rubbelbild_png.php [L]
RewriteRule ^rubbellos'.css$ rubbellos/rubbellos_css.php [L]
注意:不要忘记用实际子目录的名称
xyz