URI - Routing |
Hi,
for example let's say we have a static page: site.com/contact and our Controller should look like: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); in order to do that we will put in our config/routes.php PHP Code: $route['contact-us'] = 'contact/index'; But the problem here is that a user can access the contact page from 2 url-s: site.com/contact and site.com/contact-us But, we want access to contact form from only one from this url: site.com/contact-us Can we set up somewhere that only routes specified in config/routes.php are 'valid' and if user access a contact form via site.com/contact to see 404 page? At them moment I am doing things like this in controller: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Thanks
Why not removing the index()
PHP Code: $route['contact-us'] = 'contact/show_ContactUs'; And your controller PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |