The website I am working on has quite a few pages in it all of which have arbitrary human readable URLs, so I am using a custom URL rule in the urlManager.
But how would I check if, say, /catalogue/index already exists and is used by the corresponding controller? As of now I am checking the status code and if it’s 404 I let the validation pass through.
If the path is stored in database then you could make that field unique and Yii can handle the rest.
There is a post here with some info of how that works:
my question clearly highlights that it has to find if the path is already used by one of the existing controllers.
The user is trying to create a page that would be reached with “/catalogue”, but it’s already used by the controller called “catalogue”. Or “/site/contact” which is already used by site controller.
Sorry to have wasted your time! Not.