【问题标题】:Changing port of xampp caused project url leads to 404更改 xampp 的端口导致项目 url 导致 404
【发布时间】:2021-09-22 07:06:30
【问题描述】:

80 端口被系统占用。所以我将 xampp apache 服务器的默认端口(80)更改为端口 81。它正在工作,我的 url 中唯一的变化是,我必须像这样在 url 中输入端口号才能使其工作

localhost:81/phpmyadmin  //example

但是当我在 xampp 中将我的一个 codeigniter 项目传输到我的电脑时,所有链接标签 url 开始显示为 404。我的 css 没有被选中。这是链接标签中的网址,就像

<link rel="stylesheet" href="css/style.css">

当我检查并右键单击链接标签中的href 并单击选项Open in new tab 然后在新选项卡中,打开以下网址

localhost/project_name/css/style.css       //PORT number is missing

但这应该是这样打开的

localhost:81/project_name/css/style.css    

为什么我的 codeigniter 项目链接没有选择localhost:81,而是只选择localhost。有什么想法吗?

【问题讨论】:

  • 你在config.php的base_url中添加端口号了吗?
  • "localhost:81/project_name/" 这应该是你的 base_url
  • @IDon'tKnow 哦,是的,我没有改变它。现在,当我尝试更改它时,它工作正常。谢谢..请输入您的解决方案作为答案。我会接受的:)
  • 我的荣幸...... XD

标签: codeigniter xampp


【解决方案1】:

如果您更改了端口号,则需要更改 config.php 中的 base_url。在你的情况下应该是。

localhost:81/project_name/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    • 1970-01-01
    • 2018-10-31
    相关资源
    最近更新 更多