Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8655369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:00:42+00:00 2026-06-12T15:00:42+00:00

I using codeigniter to trying add text in routes.php , What I want to

  • 0

I using codeigniter to trying add text in routes.php , What I want to do is add text in config/routes.php, I had update the route.php file to 777 permission, but it was not working.

here is my code

$file_path = "var/www/html/staging/oscar/anthola/application/config/routes.php";
$file_exists = read_file($file_path);
$slug ="123";
if ( ! write_file($file_path, $slug))
{
     echo 'Unable to write the file';
    echo write_file('./config/routes.php', $slug);
}
else
{
     echo 'File written!';
      echo write_file('./config/routes.php', $slug);
}

Any idea how to solve my problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:00:44+00:00Added an answer on June 12, 2026 at 3:00 pm

    I agree with Robin’s comments, but if this is the route you want to go down then I would recommend adding the following line towards the bottom of your routes.php file:

    include_once APPPATH . "cache/routes.php";
    

    This way, you won’t be overwriting the default_controller and 404_override routes, but will still be able to add additional routes to your Codeigniter application.

    In your controller, you can then just add the following couple of lines

    $this->load->helper('file');
    $output = '$route["route"] = "controller/action";';
    write_file(APPPATH . "cache/routes.php", $output);
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a PHP application using codeigniter framework. I'm trying to add a tool
Using Codeigniter, I am trying to get a php script to run after a
I'm trying to parse a moderately large XML file (6mb) in php using simpleXML.
Using Datamapper 1.8.1-dev for PHP's CodeIgniter, I'm trying to build this query to prioritize
I'm trying to write a sign up form using CodeIgniter and want to use
Im currently using codeigniter 2 with ci-Smarty. Just been trying to add a smarty
Using CodeIgniter, I am trying to modify the name of the uploaded file to
I am trying to add search in my lists. I am using codeigniter and
I'm trying to download multiple files in a zip archive using PHP/codeigniter.This code works
I am using the codeigniter framework and I am trying to implement the tankauth

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.