htaccess正确吗?

发布于 2024-09-06 11:17:49 字数 355 浏览 2 评论 0原文

虽然我可以很好地运行 test.cgi 但我的 perl 全部不起作用,这个 htaccess 是否正确:

AddHandler cgi-script .cgi
Options +ExecCGI

IndexIgnore *
DirectoryIndex myapp.cgi


RewriteEngine on

RewriteRule ^$ myapp.cgi [L]
RewriteRule ^/$ myapp.cgi [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ myapp.cgi/$1

Although I can run test.cgi fine but my perl all doesn't work, is this htaccess correct:

AddHandler cgi-script .cgi
Options +ExecCGI

IndexIgnore *
DirectoryIndex myapp.cgi


RewriteEngine on

RewriteRule ^$ myapp.cgi [L]
RewriteRule ^/$ myapp.cgi [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ myapp.cgi/$1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

亚希 2024-09-13 11:17:49

事实证明,mediatemple 的 PERL 版本是 5.8.4,而我的应用程序仅与 5.8.8+ 兼容。

Turns out that mediatemple's PERL version is 5.8.4 and my app is only compatible with 5.8.8+.

纸短情长 2024-09-13 11:17:49

Apache 返回什么类型的错误?如果它看起来像权限,请尝试

Order allow,deny
Allow from all

在 RewriteEngine 行之前添加:,看看是否有帮助。

另外,除非您确定您的重写规则是正确的,否则我会将它们注释掉,直到您看到您的脚本按预期运行。如果脚本在没有它们的情况下无法工作,那么出于测试目的,将其替换为非常简单的东西,以确保 Apache 正常工作。

What kind of error is Apache returning? If it looks like permissions, try adding:

Order allow,deny
Allow from all

before the RewriteEngine line and see if that helps.

Also, unless you're sure that your rewrite rules are correct I'd comment them out until you see that your script runs as it should. If the script won't work without them then replace it for testing purposes with something really simple just to make sure that Apache's working correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文