how can i get url look like that? |
[eluser]7amza[/eluser]
Hello , i want ask you if you know any method to get url look like this one : http://domain.com/Articles?Category=45 and : http://domain.com/Controler:Articles/Category:45/ the controller name is Articles ; and Category is a method in the controller and 45 is variable . thanks , and sorry for my bad english .
[eluser]SpooF[/eluser]
Make a route. Code: $route['(:any)?(:any)=(:num)'] = '$1/$2/$3';
[eluser]7amza[/eluser]
Hello Spoof i made route like that : Code: $route['Category:(:num)/(:any)'] = 'Category/Select/$1/$2'; Forbidden You don't have permission to access /news/Category:5/TeleCommunication/ on this server. ---- news = codeigniter folder .(root) category = controller . 5 = variable(id) . Telecommunication = variable(title of category) notice : i use htaccess to remove index.php from the url .
[eluser]loosetops[/eluser]
So far you have only provided what you want the URLS to look like. What is the current access URL and how do you want them to look like? With that we can see what exactly you are doing wrong.
[eluser]7amza[/eluser]
thanks for for your reply , but i give all requested information in the first posr ; current access URL : http://site.com/Articles/Category/Press/45/ and the result i look for : http://site.com/Service:Articles/Category:Press/ID:45/ notice : i use htaccess to remove index.php from the url .
[eluser]loosetops[/eluser]
Code: $route['Service:(:any)/(:any):(:any)/ID:(:num)'] = '$1/$2/$3/$4'; You will have to do that for all the controllers whose URLs you want to change.
[eluser]loosetops[/eluser]
I have created a controller to try and imitate your urls. Here is the controller Code: <?php The URLs for this controller are Code: http://site.com/articles/category/press/45 The page output for the above URL is Quote:cat: press, id: 45 I applied this route Code: $route['service:(:any)/(:any):(:any)/ID:(:num)'] = '$1/$2/$3/$4'; Another less specific route that worked is Code: $route['service:(:any)/(:any):(:any)/:any:(:num)'] = '$1/$2/$3/$4'; Make sure the first letter capitalization for "service" is correct. Other than that I don't see why the routes aren't working for you. If you can access the controller method using the original URL, a correct route should not take you to a 403 page.
[eluser]7amza[/eluser]
loosetops thank you very much it works the problem was with the letter capitalization . |
Welcome Guest, Not a member yet? Register Sign In |