php - Codeigniter first segment URL variables -
I am looking to use a URL shortening scheme where I want the variable in the first segment of the URL, www. Example.com / 0jf08h204 My default controller is "home.php" and I have Htaccess is mod-rewrites place, so what's the best way to manage it? I believe that my SmartTech has been blocked by the standard / controller / method / variable plan, is this a URI protocol setting? Thanks!
To add to Matthew's reaction.
You will need to be in your system / application / config / routes.php
file:
$ route ['(any)' ] = "Home";
All this will redirect.
You do not want to redirect everything, if you have other controllers that need to be used. If this is the case, then you can use this regular expression instead:
$ route ['^ (?! About | contact) \' * '] = "home";
This will allow you to redirect everything except about controllers or 'contact' - they will be directed to 'about.php' and 'contact.php' controllers.
Please note, I choose not to use the wild card inside the codeigner, you may find that they are working better for you, but still after the redirect manually, $ _SERVER [ 'REQUEST_URI']. If you want to use the wildcard, you will add the / $ 1
to the routes just as a response to matw.
Comments
Post a Comment