Redirections with .htaccess |
[eluser]Razican[/eluser]
Hello, I have a controller named error.php which controls all the erros like "Incorrect password" or "Incorrect email" with the function index. If I want to show the "Incorrect password" error, I have to redirect the user to example.com/error/index/1 or example.com/error/index/2 for the email error. I would like to remove the /index part of the URI with .htaccess, like I did with the /index.php/ part. How can I do it? I have tried to add this in the .htaccess file but it doesn't work: Code: RewriteRule ^error/([0-9]+) error/index/$1
[eluser]mddd[/eluser]
You don't need to do any .htaccess redirection for that. Use the _remap() method in your controller to show the right info without putting the name of the index() method in the url. Check out the page on Controllers and remapping. Code: class Error extends Controller
[eluser]Razican[/eluser]
Code: function __construct() That code is the same as this? Code: function Error()
[eluser]mddd[/eluser]
Yes. The __construct() is for php5. Error() works for php4 and php5 (if the name of the class is Error).
[eluser]Razican[/eluser]
And which is faster? Because I want to make a the fastet app as posible.
[eluser]mddd[/eluser]
I don't think there is any difference between the two. Both will be tried when the class is instantiated.
|
Welcome Guest, Not a member yet? Register Sign In |