After changing api route path it is not working after deployed on vercel

未关闭
#116 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
php
领域
api, backend, cloud

调研方向

Start with the RouteServiceProvider route group, routes/api.php, and the shown .htaccess rules, then check how this PHP example is configured for Vercel deployment. Reproduce the deployed request with and without index.php and determine what configuration or rewrite behavior causes the 404. Done means the /api/... route works on Vercel without index.php.

由索引模型根据 Issue 内容生成。

描述

Bug report

I have server like "api.xxx.dev/backend/..." I have changed prefix backend to api
New path is "api.xxx.dev/api/.."

It is not working on development server getting 404 response code
but If I am using "api.xxx.dev/index.php/api/.." It is working on server

and I need to remove index.php from url

My Routeserviceprovide is

Route::middleware('api')
->prefix('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));

And my .htaccess file is

Options -MultiViews -Indexes
RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index.php/(.+) /$1 [R=301,L]

Is there any required thing to do on vercel?

主要语言
PHP
星标
357
派生
149
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

contributte/vercel-examples 的其他 Issue

查看 contributte/vercel-examples 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。