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

  • SEARCH
  • Home
  • 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 8835371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:14:46+00:00 2026-06-14T09:14:46+00:00

for some reasons i’ve been having problems with mod rewrite, i have the index.php

  • 0

for some reasons i’ve been having problems with mod rewrite, i have the index.php removed from the url ok but when i try to do the same for profiles it shows some contact webmaster page.
Now i’m taking the routes option but i have a little problem.

My url is http://website.com/user/profile/user_profile/username 

I have this in my routes

$route['profile/(:any)'] = 'user/profile/user_profile';

So when i type in website.com/profile/username, it works fine. My question is, what if i want to get rid of the /profile as well and have website.com/username, how do it go about it with routes?

Just incase, i might as well put my trail with modrewrite on here so all you brilliant minds can tell me where i’m going wrong.

Options FollowSymLinks
RewriteEngine on

RewriteCond $1 !^(index\.php|images|css|javascript|cron|sit-env|robots\.txt)

RewriteCond $1 !^(index\.php|javascript|sit-env|robots\.txt)

RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond $1 !^(index\.php|images|css|javascript|cron|sit-env|robots\.txt)

RewriteCond $1 !^(index\.php|javascript|sit-env|robots\.txt)

RewriteRule ^([0-9a-zA-Z]+)([\/]?)$ /user/profile.php/user_profile/$1 [L]

Thanks in advance 🙂

  • 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-14T09:14:47+00:00Added an answer on June 14, 2026 at 9:14 am

    I simply used the 404_override method to capture any routes not already defined in CodeIgniter and then done a database look up before showing the 404 page.

    My example is actually for a CMS however it could easily be changed to suit your requirement.

    public function error_404()
    {
        $Path = trim(uri_string(), '/');
        $this->load->model('page_model');
        $Page = $this->page_model->GetByPath($Path);
        if(empty($Page))
        {
            $ViewData = array
            (
                'PageTitle' => 'Error 404'  
            );
            $this->load->view('error_404', $ViewData);
            return;
        }
        else
        {
            $ViewData = array
            (
                'PageTitle' => $Page->Title,
                'Keywords' => $Page->Keywords,
                'Description' => $Page->Description,
                'CurrentPage' => $Page->Path,
                'Page' => $Page
            );
            $this->load->view('generic', $ViewData);
        }
    }
    

    Within my application/config/routes.php file, I simply put

    $route['404_override'] = 'controller/error_404';
    

    replacing controller with the controller that contains the error_404 action.

    You could use the segments collection to find the username passed to www.domain.com/username failing that, in line with your original request:

    $route['profile/(:any)'] = 'user/profile/user_profile/$1';
    

    The above will route www.domain.com/profile/abc123 to www.domain.com/user/profile/user_profile/abc123

    Hope this helps?

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

Sidebar

Related Questions

For some reasons I have a 663.php file in every folder and subfolders of
For some reasons this part where I fetch JSON data from following url will
I read here some reasons to use constraints instead of triggers. But I have
I have .NET program that can't be run from Visual Studio for some reasons
We have own linux server, with a git server. But for some reasons we
I have some problems with the Propel's archivable behavior. For some reasons, Propel doesn't
for some reasons, our hosting company used PHP 5.2 and doesn't even have mysqli
For some reasons we have situations when we have to set properties from a
Looking at some tutorials I have added the radio button but for some reasons
For some reasons, my will_paginate collection is stuck on page 2. I have the

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.