Salman Khimani
Salman Khimani

Reputation: 515

CodeIgniter with encrypted URLs

I want to use codeigniter framework for my project but I dont want it readable, so i have to encrypt url like:

http://myproject.com/index.php/indexcontroller/myaction/

into:

http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw

I dont know how to achieve such scenario. How controller and methods will be called and how it will be performed. Please guide me.

Upvotes: 2

Views: 2052

Answers (2)

assaqqaf
assaqqaf

Reputation: 1585

you can solve this problem by play with: application/config/routes.php

$route['(:any)'] = "controller/myaction/$1";

for more information URI Routing documination

Upvotes: 2

gen_Eric
gen_Eric

Reputation: 227310

This sounds like a job for URI routing!

Add this to your config/routes.php:

$route['(:any)'] = "MyController/MyFunc/$1";

Now when you go to:

http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw

it will be "redirected" to:

http://myproject.com/MyController/MyFunc/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw

From there, you can "decode" the URL, and redirect to where you want to go.

Upvotes: 3

Related Questions