Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Help With Urls

$
0
0
I think this should be a simpler problem than I'm making it, but I've been playing with it for a few hours and can't figure it out. Any help would be appreciated.

I developed a site that has a super-simple content management system that allows an administrator to create/edit pages that are accessed at "url.com/index.php/event/event-id" where event-id is a text string. The page IDs are stored in a database. The Event controller handles the requests using the View action.

I'm trying to use this site as a framework for a new site, but the new site requires that the URLs not have "event" on the front of them. So I want what used to be "/index.php/event/event-id" to just be "/index.php/event-id". I've tried playing with URL rules in the URL manager in config/main.php and I've tried adding a View action to the Site Controller that forwards requests to the Event controller, both with no luck. In particular, when I try to use the View action in the Site controller, the "event-id" gets turned into a string containing the word "error", which then causes a CHttpException error saying the request is invalid - because "error" isn't an ID it can find in the database.

Like I said, I think there's probably a simple URL manager solution or something, but I can't get my head around it. Any ideas? Thanks.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>