URL redirection in codeigniter - codeigniter

I need help in url redirection in codeigniter,
I have following url
http://test.com/MyProject/My13d2lnbGlsZGNtcWt0Z2w=
When I click above url, then it should redirect to my function like,
http://test.com/MyProject/api/TestingManagement/getMyUrl/My13d2lnbGlsZGNtcWt0Z2w=
We can do it with CI routes or .htaccess, but how?
Thanks in advance

For Routes you can write following as last rule:
$route['(:any)'] = 'api/TestingManagement/getMyUrl/$1';

Related

Redirect non-existent url to home in Codeigniter

A client has seen a non-existent page show up in Google Analytics and would like it redirected to the home page. I am new to CodeIgniter.
I don't see an .htaccess file in this project in the root directory, and tried the following in the routes.ph but it did not work. Do I need to add something in routes.php?
$route['strangepage'] = 'Home';
Try This--
Please put in application->config->routes.php
$route['default_controller'] = 'home';

Need to change hmvc routes in CodeIgniter

I have CodeIgniter HMVC application and I want to change route as per requirement.
Now I have website/product/detail/url, and I want to change it with website/url.
Once I set URL from admin side it will redirect to my route.
This is what I have now:
$route['Products'] = "Products/detail/d101productdatatest(this is url)";
And I want in my url like website/url and it will open same page what I have with website/product/detail/url
From the given library:
https://www.codeigniter.com/userguide3/general/routing.html
routes as above:
$route['controller/function'] ='website/Products/detail/d101productdatatest';
But as per your given question:
you cannot manipulate url using routes
you can map same function with different url using routes
you have to use .htaccess to redirect to specific url after hitting the previous given url.
htaccess example:
Redirect /index.html /new/
Redirect /index.html /default.html
Redirect /private/ http://www.example.com/private/
Redirect /img/logo.gif http://www.example.com/images/logo.gif
Hope this answer helps you out !!
cheers

Route to a specific controller in codeigniter

I am using codeigniter for the back end of my website.
For that I have created admin folder inside my controller.
My issue is that when i type the url
http://localhost/varma/admin
It should redirect to the file login.php which is inside the contollers/admin
Inside the routes.php write this code:
$route['admin'] = 'admin/controller/function';
Try this code in your routes.php file ,
$route['admin'] = 'admin/login/your_login_function_name';
$route['admin']='admin/login';
where login the is login function name

how can url masking in codeigniter?

my url www.xyz.com/as/as/as/as but .com after all controllers and method hide or minimize to how and use in codeigniter.
how can url masking my url www.abc.com/as/a/s but show only www.abc.com only. how can solve this error in codeigniter
You could just set the default_controller in routes.php to;
$route['default_controller'] = 'as/a/s';
https://ellislab.com/codeigniter/user-guide/general/controllers.html#default

Laravel URL without Mod_rewrite

I want to call an function in a controller in a cronjob. This is not working because of mod_rewrite.
What is the correct URL for accessing this function without mod_rewrite?
For example, my url with mod_rewrite is:
http://url.com/public/index.php/cron/time_enabled
How can i call this without mod_rewrite?

Resources