gpt4 book ai didi

mod-rewrite - Heroku PHP 雪松堆栈 : can I do URL rewrites?

转载 作者:行者123 更新时间:2023-12-04 23:57:42 28 4
gpt4 key购买 nike

我正在 Heroku cedar 堆栈上运行一个 PHP 应用程序。有没有办法设置 URL 重写规则?我曾希望在 .htaccess 文件中执行此操作,但在此只能识别访问控制指令。

我看到 Ruby 的建议是使用 rake 重写,但是对于在 Heroku 上具有 URL 重写配置的 PHP 应用程序需要做什么?

最佳答案

您可以使用普通的 .htaccess在 Heroku 上使用 PHP 文件。只需创建一个 .htaccess具有重写条件的文件,类似于:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

这个例子来自 WordPress。我相信现在所有的网址都重定向到 /index.php .此处示例: https://github.com/catsby/php-heroku-htaccess和应用程序在这里: http://php-heroku-htaccess.herokuapp.com/something

关于mod-rewrite - Heroku PHP 雪松堆栈 : can I do URL rewrites?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15038156/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com