CodeIgniter Forums
Redirect using Except (Regex) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Redirect using Except (Regex) (/showthread.php?tid=32462)



Redirect using Except (Regex) - El Forum - 07-24-2010

[eluser]dartmouth114[/eluser]
Edited :

Ok, so I figured out how to do this, but still don't know the Regular Expression for this..

Basically, I want to redirect all URL WITHOUT "main" into another controller..

For example,

http://mywebsite.com/someword -> http://mywebsite.com/specificcontroller/someword
http://mywebsite.com/otherword -> http://mywebsite.com/specificcontroller/otherword
.....
.....

Only http://mywebsite.com/main that is redirected to main...

So, how do I do this ?


Thanks again..

----------------
Hi all gurus of CodeIgniter..

I'm new to CI. I wanna ask a question.

Suppose that I have a URL like this : http://mywebsite.com/client_x_page that I want to redirect to http://mywebsite.com/mycontroller/myfunction/client_x_page

And suppose that there are many client pages, such as :
http://mywebsite.com/client_a_page
http://mywebsite.com/another_page
...

And all of the "client_a_page", "another_b_page", are dynamics, that I stored in the DB..

And all of the URL WITHOUT the word "main", or http://mywebsite.com/main will redirect to mycontroller/myfunction/....


What should the route look like?

I'm a little puzzled...

Thanks in advance.. Smile


Redirect using Except (Regex) - El Forum - 07-24-2010

[eluser]dartmouth114[/eluser]
Okay, got it.. haha...
Stupid question.. I didn't know CI can use Regex..

I just use this : ^(?!main).+