Routes Issue

#1
[eluser]MianUsman[/eluser]
Hi All,

sorry to disturbed all of u , today i am facing a big problem ,let me explain my problem
my problem is relevant to URL Rewriting,

i am making a site in multilingual my URL is current become like this

www.abc.com/fr/pages/index/contact

but i want URL in this way

www.abc.com/fr/pages/contact

i want to remove the function name from my URL
can anybody help me to get rid of this problem.

Thanks in Advance.
Take Care.
Bye.

#2
[eluser]Dam1an[/eluser]
Have you even read the user guide, theres a nice section on URI routing

Once you've tried that and are still stuck, post back what code you've got and we can help you some more

#3
[eluser]MianUsman[/eluser]
hi thanks for quick reply

i write in routes file

$route['page/(.+)'] = "page/index/$1";

but my problem is i want to add language code before the controller and eliminate the function name , bcz it make URL too long,which i dont want

if u have some other idea plz let me know.

Regards.

#4
[eluser]MianUsman[/eluser]
Hi

i set the route but its not work fine can someone guide me ,

$route[‘fr/page/(.+)’] = “fr/page/index/$1”;


Regrads.

#5
[eluser]Dam1an[/eluser]
Why are you passing the function name into the index method?
Do you not want something like:
Code:
$route['(en|fr|de|etc)/page/(.+)'] = 'page/$2';

#6
[eluser]MianUsman[/eluser]
yes i want this
but problem is that my url should become like that sir

www.abc.com/fr/auction/residential


here residential is not function its category name ,
what i want to remove the function name from my url

Thanks.

#7
[eluser]Dam1an[/eluser]
Oh, right, I assumed seeing as you where passing something into index and said you wanted to get rid og function name, you where doing some huge switch in your index function

So assuming you have a function call search_by_category, you could use
Code:
$route['(en|fr|de|etc)/auction/(:any)'] = 'auction/search_by_category/$2';
Where $2 is the category in the URL

#8
[eluser]MianUsman[/eluser]
is it possible to do that
to put language code in start then controller name and the id not function name ,
my mind is stuck now,

help me get rid of this problem

#9
[eluser]Dam1an[/eluser]
I've not tested it, but there's no reason I see why it wouldn't work
You can do almost anything with routes Smile Just a little bit of reading the User Guide and trial and error

#10
[eluser]MianUsman[/eluser]
Hi Sir,

hope u will be fine , i solve my problem thanks for urs reply i need to ask one more question Smile
can we write one route which is consider first argument as language code , right now for each function
i have to write this type of routes,

$route['(en|sp|por|pol|chn)/auction/signup'] = 'auction/signup';
$route['(en|sp|por|pol|chn)/auction/login'] = 'auction/login';
$route['(en|sp|por|pol|chn)/auction/forgetpassword'] = 'auction/forgetpassword';

i think this is not a good approach i am really new in routes/htacess,


Regards,
Thanks in Advance.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.