In codeigniter I am routing my url www.xxxxxx.com/jewels to www.xxxxxx.com/luxury-jewels by using the following code in routes.php,
$route['(.*)luxury-jewels'] = "jewels";
the above code working well for english language when i am my other language its adding new parameter "ru" in the URL For Example:
www.xxxxxx.com/ru/luxury-jewels when doing this i am getting 404 Page Not Found error.
I tried different routing combinations its not working.
Intend of using
$route['(.*)luxury-jewels'] = "jewels";
use
$route['(:any)/luxury-jewels'] = "jewels";
Tested and works for me.
You need to add another route for it.
e.g
$route['ru/luxury-jewels'] = "jewels";
or
for many languages
$route['(:any)/luxury-jewels'] = "jewels";
Related
I am little bit confused on how routes work in codeiIgniter. I have set up this following route
$route['myfirstest'] = 'Blogs';
I then set up a php file called blogs.php under the application/controllers directory
When I run the following URL
/code_igniter/index.php/myfirstest/hello/hello
I get a 404 message
However when I run this following URL
/code_igniter/index.php/blogs/hello/hello
It works find
Can anyone please help me figure this out..Maybe I am not getting the whole route thing correctly..
I think this will work for you
$route['myfirstest'] = 'Blogs';
$route['myfirstest/(:any)'] = "Blogs/$1"
This will also work for you.But I don't think this is your real purpose.
$route['myfirstest/hello/hello'] = "Blogs/hello/hello";
If you want any value inside hello function you can write this way
$route['myfirstest/hello/(:any)'] = "Blogs/hello/$1";
Remember for 2nd and 3rd solution you also need to write
$route['myfirstest'] = 'Blogs';
I hope I can manage to explain this problem...
I have an T3-extension that handles shared content.
In this shared content, we have links (page-ids) that are defined and converted into something like /en/clients/contact, using
$cObj = t3lib_div::makeInstance('tslib_cObj');
$href = $cObj->getTypoLink_URL($linkValue); // $linkValue is an integer (e.g. 153)
This works fine - until I change the language on the page. Then, the last used URL kinda «sticks» and the language indicator isn't present in the URL anymore.
Means:
call the german page -> works
change to english -> works
change back to german -> the english link is presented.
So the above link turns out like clients/contact (the leading slash is gone as well).
Oddly enough, I have a local installation of the same page where the problem doesn't occur. It's just on the page that's online.
I tried to find differences in the configuration, but there aren't any.
The only difference I could find so far is, that I use Typo3 v4.5.35 for the local installation and v4.7.17 for the online installation.
Any ideas???
This was very odd... but, I found a solution.
Instead of using $cObj->getTypoLink_URL($linkValue); I'm using this:
$configurations['additionalParams'] = "&L=".(int)t3lib_div::_GP('L');
$configurations['returnLast'] = 'url'; // get it as URL
$configurations['parameter'] = $linkValue;
$href = $cObject->typolink(NULL, $configurations);
It seems that when I created the $cObj, the L-Parameter got lost somewhere, somewhen. By adding it manually, the Link works as expected.
I want a piece of code on the index of my Code Igniter's script so I can change the identety or name of my controller from agent69 to agent007_and_supergirl,and also a way to beat any rule that pages might have against using underscore to separate words as an amendment.
In other words I want that all the calls that the processor of my server has inside my code igniter for agent69 be translated to calls to agent007_and_supergirl
Is just a change of identety for the controller without altering the main controler's functionality and without getting my hands dirty with coding.
If you want re route your default controller url, you have to edit routing configuration like this:
in application/config/route.php
$route['agent007_and_supergirl'] = 'agent69';
Now agent69 Controller will be accessible by http://youriste.com/agent69 and http://yoursite.com/agent007_and_supergirl as well
CodeIgniter URI Routing Guide
Working on config/routes.php yelded miserabe results on past,remember that is an identity matter
And I want all the calls of agent69 be sent to agent007_and_supergirl that is its new identity
What was successfull on the past about this mattar was controller and file cloning,it worked masterfully
but this only intercepted few server calls so for me to get all the server calls, I need to clone every
single fie on the script so I feel silly teling you again thats why I didnt want to get my hands dirty with code
because is plenty of code.
Well hope that you can help me master this code that goes on the index of my code igniter script--///The code cant appear here so its below in the comment to lighta thanks 4 readin
I'm attempting to get the referrer URI in Kohana 3.2 using the following code:
$referrer = $this->request->referrer();
var_dump($referrer);
However the function returns NULL, I'm expecting it to return the page I left to get to this one.
Is that how it should work... and if so what am I missing or doing wrong?
This is being run in the Controller.
Documentation here: http://kohanaframework.org/3.2/guide/api/Request#referrer
The issue I was having was cause by the way my Kohana system is setup. Basically I have a routeHandler in the middle of my system which controls the routes users take. In that script a new request was generated and then executed.
What was happening was when creating the new request object it wasn't having the referrer uri added to it. I have added the following code and now I am able to get the referring uri from the controller at the end of the routing process.
$referrer = $this->request->referrer();
$request = new Request($uri);
$request->referrer($referrer);
echo $request->execute()
->send_headers()
->body();
Alternatively a cleaner more native solution as suggested by atma is the following:
Request::initial()->referrer()
I'm setting up routes in application.ini, so when I try to access /moved, it displays cont/move. It works but only if I type moved all lower letters exactly like it's setup on the first line. How can I make Moved or moVed or any other letter combination also work? Do I need to do it in Bootstrap to get finer control and how?
routes.test.route = moved
routes.test.defaults.controller = cont
routes.test.defaults.action = move
This is not a wise approach.
URLs are case sensitive for a reason. You will get duplicate content penalty from search engines. Users will be confused too.
However, you may create controller plugin to achieve this:
public function preDispatch()
{
$this->getRequest()->setControllerName(
strtolower($this->getRequest()->getControllerName());
)->setDispatched(false);
}
I've searched Google for a few minutes, and this page (http://joshribakoff.com/?p=29) covers a nice patch. This patch overrides the request object, instead of the dispatcher or the router.