Welcome Guest, Not a member yet? Register   Sign In
How to do URL Rewriting in codeigniter
#1

[eluser]ssrawat[/eluser]
Hi,

I am stuck on rewriting url. I m already using.

RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]

My problem is, I want to run something like

RewriteRule ^([a-z,0-9,-]+)/([0-9]+)/$ /index.php?/get_page/$2 [L]


I have made get_page is a function on home controller, and want $2 be passed on this function. Is this possible on codeigniter environment to have our own rules like we do in core php.

I tried but the above code is not working.

Thanks in advance...if anyone can help me then pls give me reply on my email idConfused[email protected]
#2

[eluser]weboap[/eluser]
check the user_guide for
routes :
http://ellislab.com/codeigniter/user-gui...uting.html

uri : ($this->uri->segment(n))
http://ellislab.com/codeigniter/user-gui...s/uri.html

will resolve your issue without having to mess that much with the .htaccess

and don't forget to search the forum for other threads about both items .


#3

[eluser]ssrawat[/eluser]
Thank you boss...It made my day...i was trying this since 3 days......n within your post i did it in with 1 hour....Thanks a ton....
#4

[eluser]weboap[/eluser]
you are welcome!




Theme © iAndrew 2016 - Forum software by © MyBB