Question

i would like to shorten http://fpmls.ca/index.php/user/user_postdetail/index/14 to http://fpmls.ca/index.php/post_14.html.

user_postdetail is a controller and index is a function of this controller 14 is id(dynamic)

My .htaccess code is:

RewriteEngine On           
RewriteRule ^post_([0-9]+).html$ index.php/user/user_postdetail/index/$1

I am getting the URL, but "404 Page Not Found: The page you requested was not found." is shown in that page. Any one please help me

Was it helpful?

Solution

Using routes.php in the configuration directory, define the following rule:

$route['post_(:num).html'] = 'user/user_postdetail/$1';

Alternatively, you can leave out the .html and make the your URI suffix in the app's configuration.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top