简体   繁体   中英

Codeigniter URL rewrite — Something strange

I just re-writed using htaccess ( with that I just removed the index.php part )

I just got a URL like this

http://localhost/mvc/movies/movie/3237-Movie-name-here

where mvc - this root folder movies - controller movie - view 3237- Query string for getting from DB ( pk) Movie-name - for SEO URL

with this I can get the movie details with pk 3237

Now I just need to rewrite this url to ( using htaccess )

http://localhost/mvc/movie/3237-Movie-name-here

Please help Thanks

You can use CODEIGNITER Routing. Described in here http://codeigniter.com/user_guide/general/routing.html

In your case $route['mvc/movies/([:num)/(:any)'] = "mvc/movie/$1-$2";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM