似乎无法 mod_rewrite 实际存在的路径
我想重写如下:
RewriteRule ^abc([.]*)$ /abc.py$1
如果 abc 不是目录,则此方法有效。即 http://eg.com/abc 将根据需要显示 abc.py 页面,但是如果我 mkdir abc
在根目录中,然后 http://eg.com/abc 将实际显示内容abc 目录的。
如果 /abc
是目录,如何使重写显示文件 /abc.py
?
I want to rewrite as follows:
RewriteRule ^abc([.]*)$ /abc.py$1
This works if abc is not a directory. I.e. http://eg.com/abc will show the abc.py page as desired, however if I mkdir abc
in the root then http://eg.com/abc will actually show the contents of the abc directory.
How do I make the rewrite show the file /abc.py
if /abc
is a directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许可以尝试这个:
对我来说它工作得很好。
使用
[R]
您将更容易看到结果。您还可以尝试将
RewriteBase /
添加到 .htaccess 文件中 RewriteRule 之前。当我使用 [.] 而不是仅使用 .我根本无法使重写工作,所以我无法真正准确地重现您的问题,但希望这有任何帮助。
Maybe try this instead:
For me it works just fine.
With
[R]
you will see the result more easily.You can also try adding
RewriteBase /
to the .htaccess file before the RewriteRule.When I used [.] instead of just . I couldn't make the Rewrite work at all, so I wasn't really able to reproduce your issue exactly, but hope this is of any help.