Search code examples
codeigniterxampp

Changing port of xampp caused project url leads to 404


Port 80 is occupied by system. SO I changed the default port(80) of xampp apache server to port 81. It is working and only thing changes in my url is, I have to type port number in url like this to make it work

localhost:81/phpmyadmin  //example

But When I transfer my one codeigniter project to my pc in xampp then all link tag urls started to show as 404. My css wasn't getting picked. Here is the url in link tag were like

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

When I inspect and rightclick on href in link tag and click on option Open in new tab then in new tab, following url open

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

But this should have open like this

localhost:81/project_name/css/style.css    

Why my codeigniter project link is not picking localhost:81 but instead it is picking only localhost. Any idea?


Solution

  • If you have changed the port number then you need to change the base_url in config.php. In your case it should be.

    localhost:81/project_name/