need help with .htaccess |
[eluser]Yours3lf[/eluser]
Hi, I wrote a CI app, and now it's time to make it work. The app is divided to controllers that have functions. Now if I want to access a controller's function I have to do this: http://example.com/controller/function1/...am3/param4 Now to make this google friendly I tried to write a .htaccess file, which rewrites the urls so that each function has a specific name that is translated. For example: http://example.com/name1/param1/param2/param3/param4 translates to: http://example.com/controller/function1/...am3/param4 but this wouldn't work. I tried to debug it by redirecting the url (using [R]), and that way it did work, but without that it doesn't. Here's the .htaccess code: Code: RewriteEngine on what am I doing wrong?
[eluser]Adam Liszkai[/eluser]
Hi! My .htacess file: Code: RewriteEngine On And you can rename in /application/config/routes.php Code: $route['default_controller'] = "page"; Here when the url fisrt section is not admin or login or download then rewrite the code page/lang/ parameters... And if you want it rename this shuld work(but im not test it): Code: $route['^(?name1).*'] = "name1/function/$0"; Cheers! ![]()
[eluser]Yours3lf[/eluser]
Thanks Adam Liszkai, I didn't know CI has a feature like this ![]() This gave me the idea to do things like this. The suggested form of the regex didn't work, but after looking up this feature in the CI user guide, I came up with this: $route['name1/(:any)'] = "controller/function1/$1"; works like charm ![]()
|
Welcome Guest, Not a member yet? Register Sign In |