Welcome Guest, Not a member yet? Register   Sign In
.htaccess file and url. how to make in shorter?
#1

[eluser]linderox[/eluser]
i have a function1 in the controller1

www.mydomain.com/controller1/function1/parametr1, but I want to save such construction of the controller file, but I want to reach this url by shorter line (without function1 name)
www.mydomain.com/controller1/parametr1

here is my standart .htaccess file
Code:
addDefaultCharset utf8
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|public|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
#2

[eluser]Dam1an[/eluser]
You only have 1 function in each of your controllers? or do you want all but one of the functions per controller to be routed as normal, and just the one which doesn't?
#3

[eluser]linderox[/eluser]
I want to change just one function. There are lot's of function in the controller
#4

[eluser]n0xie[/eluser]
Is this what you are looking for? URI Routing
#5

[eluser]Evil Wizard[/eluser]
You should also look at the method "_remap()"
#6

[eluser]linderox[/eluser]
I look into URI Routing and understand that it could redirect to the existing page, but I want to create some virtual link

for example mydomain.com/people/index/nick I want to replace with mydomain.com/people/nick
#7

[eluser]n0xie[/eluser]
[quote author="linderox" date="1244133511"]I look into URI Routing and understand that it could redirect to the existing page, but I want to create some virtual link

for example mydomain.com/people/index/nick I want to replace with mydomain.com/people/nick[/quote]
Isn't this exactly what the URI routing does?
#8

[eluser]Dam1an[/eluser]
[quote author="n0xie" date="1244133838"][quote author="linderox" date="1244133511"]I look into URI Routing and understand that it could redirect to the existing page, but I want to create some virtual link

for example mydomain.com/people/index/nick I want to replace with mydomain.com/people/nick[/quote]
Isn't this exactly what the URI routing does?[/quote]

Yeah, so a route like this should work
Code:
$route['people/(:any)'] = 'people/index/$1';

If you have any other functions with can be called in the url, such as /people/add, make sure someone can't have 'add' as a name
#9

[eluser]linderox[/eluser]
thank you it works!

and what about link to the files?
I want to hide link to some *.jpg file how to do this?

I have some path to the image file for example mydomain.com/images_files/img_2323.jpg, and I want to see the file on a page on a mydomain.com/jpg/111111/




Theme © iAndrew 2016 - Forum software by © MyBB