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 6613789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:15:37+00:00 2026-05-25T20:15:37+00:00

I am using the CodeIgniter framework and I am confused on how to remove

  • 0

I am using the CodeIgniter framework and I am confused on how to remove %20 from my urls. Below is an example of my code.
Controller – blog
method – show
attribute – this is my blog

public function show($blog= null)
    {
    // my attempt to set the uri segment
    $blogName = $this->uri->segment(3, url_title($blog));
    ... //other code
}

this doesnt work, I am confused where I implement the url_title(‘this is my blog’) function so that on page load it shows:

/blog/show/this-is-my-blog

do I need to do something in the config/routes.php file?

thank you!

EDIT:

Alright so I found out that url_title() output this20is20my20blog so I now have this:

      $blogUrl = str_replace("%20", "-", $blog);
    $this->uri->segment(3, $blogUrl);

but it still returns the URL with %20

  • 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-05-25T20:15:38+00:00Added an answer on May 25, 2026 at 8:15 pm

    You just need to use the native php function urldecode to remove any characters that get encoded in a url. Spaces in a URL get encoded to %20 so instead of doing a str_replace just try

    public function show($blog= null)
    {
        // i'm not sure what url_title does so you might have to tweak this a little
        $blogName = $this->uri->segment(3, urldecode(url_title($blog)));
    }
    

    http://php.net/manual/en/function.urldecode.php

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

Sidebar

Related Questions

I am using codeigniter framework. where should i sanitize PHP input - controller or
I have the following php code using the codeigniter framework $this->form_validation->set_rules('money', 'Money', 'integer|required|xss_clean'); It
I am using codeigniter php framework. I am suffering from the problem that all
I am so confused right now, I am using code igniter php framework and
I'm using following code to display an image with CodeIgniter framework. <?php echo img('sample/logo.png');
I have this code here in PHP using Codeigniter framework, I can't seem to
I'm using the codeigniter framework, I'm retrieving data from the database in the form
I am using Codeigniter framework and I have a form with input fields. When
I'm using CodeIgniter (a PHP framework) to build an app, and I have an
I'm creating my own script using the CodeIgniter MVC framework. Now, i want users

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.