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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:49:55+00:00 2026-06-02T06:49:55+00:00

I am building a blog-ish site using CI. I am using the HMVC plugin

  • 0

I am building a blog-ish site using CI. I am using the HMVC plugin. The module that I am working in is “/journal”.

The individual articles are accessed at /journal/article/ID/SLUG. This works fine, but I would like to shorten the URI to /journal/ID/SLUG using mod_rewrite.

Here are my rules:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^journal/([0-9]+)(.*)$ index.php?/journal/article/$1$2 [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1

For testing I am using /journal/2.

I know that the rules is matching. If, for instance, I change the redirect to http://google.com, I will indeed get redirected to Google. However, when using the rule as written it seems to be ignored and I get a 404 no matter what I put in.

Am I making some obvious (or arcane) error?


Edit: I figured this out shortly after posting the question. My rules are indeed correct but I need to change the following line in config/config.php:

 $config['uri_protocol']    = 'AUTO';

to

 $config['uri_protocol']    = 'PATH_INFO';

I won’t claim to know exactly what that change does or why it fixes the issue. Perhaps someone can follow up with an explanation.

  • 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-02T06:49:59+00:00Added an answer on June 2, 2026 at 6:49 am

    The $config[‘uri_protocol’] tells CI which $_SERVER superglobal to use to determine your apps URI. The ‘PATH_INFO’ option uses $_SERVER[‘PATH_INFO’] which is the URL request (without host portion), see php manual.

    The ‘AUTO’ option is a CI thing to make suitable for different environments without config tweaks.

    Personally, I have written a few PHP SEF controllers, I find it better to do all the processing with the PHP controller(s) scripts.

    htaccess and rewrites can be tricky, harder to debug and one typo can kill the whole site (ouch). I am sure there are small performance gains, but one would need some pretty heavy demands. You are heading to your index.php controller anyway. I find happier code when it is all in one place 😉

    good luck with it…and hopefully I provided some insight to your issue.

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

Sidebar

Related Questions

So I'm building a blog engine which has /articles/then-the-article-permalink as it's URL structure. I
I am using the Facebook comments plugin on a blog I am building. It
I am building a basic blog module that allows the user to rate the
I'm building a blog that should parse bbcode tags like this: Input: <youtube=http://www.youtube.com/watch?v=VIDEO_ID&feature=channel> Output:
Lately I've been thinking a lot about building a website/blog/community oriented site. However I
I'm building an app for a blog site. I have a UINavigationController with a
I'm building an authors page for my Wordpress blog that lists all the current
I am building a group blog that is moderated by the community. When a
I am building a Django application that is a pretty basic blog, so far
I am building a static site using php files. On the index.php file, I

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.