Welcome Guest, Not a member yet? Register   Sign In
Redirect using Except (Regex)
#1

[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/myfunc...ent_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
#2

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

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




Theme © iAndrew 2016 - Forum software by © MyBB