Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using codeigniter... I want a clean URL from below URL

  http://localhost:8080/rtvnews/index.php/home/videonews?id=67598/newstitle 

here home => controller, videonews => function and ?id=6586565 is a url string.

I want to remove /index.php/home/videonews?id=67598 and replace with /news/

Below Final url I need to get

  http://localhost:8080/rtvnews/news/newstitle 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
258 views
Welcome To Ask or Share your Answers For Others

1 Answer

Follow the steps below

Step 1: .htaccess (the one which is at root folder)

Options All -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Step 2: routes.php add the code below

$route['rtvnews/news/newstitle'] = 'Your controller/method']; //Just a syntax to change the route in codeigniter. You can change the url as per you want.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...