1

I have a problem in url structure ... I have 3 categories

  1. streaming
  2. movies
  3. serials (dramas)

My Url structure is

example.com/stream/CategoryName/Channel Name
example.com/movie/CategoryName/MovieName
example.com/serial/CategoryName/Serial Name

I've added in this code in routes.php

$route['stream/(:any)/(:any)'] = "main/stream/$1/$2";
$route['movie/(:any)/(:any)'] = "main/movie/$1/$2";
$route['drama/(:any)/(:any)'] = "main/drama/$1/$2";

with this structure the website is working good. but client want that the url only contain the category name / Video Name

If i remove stream/movie/drama before /(:any)/(:any) in route then the controller get confused which function to call.

Example what i need

example.com/CategoryName/Channel Name
example.com/CategoryName/MovieName
example.com/CategoryName/Serial Name

What should i do ?

1 Answer 1

0

Uh this is really bad situation. My solution would look something like this.

$route['steam-(:any)/(:any)'] = "main/stream/$1/$2";
$route['movie-(:any)/(:any)'] = "main/movie/$1/$2";
$route['drama-(:any)/(:any)'] = "main/drama/$1/$2";

But then u must edit your controller methods to explode first uri by '-' or something like that u can use parsed uri as before in method. Hope this will help you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.