Welcome Guest, Not a member yet? Register   Sign In
Clean URL
#1

[eluser]Pellens[/eluser]
Hi webmasters,

I have a website using the following URL:
http://www.reisgoedkoop.com/index/lijst/...prijs_max/-

I would like to make it shorter, is it possible to hide the controller index and function lijst? Like following:
http://www.reisgoedkoop.com/type/zomerva...prijs_max/- or even
http://www.reisgoedkoop.com/zomervakanti...prijs_max/-

I've tried some routing, as well .htaccess but I'm not able to make it work,
also I don't know if it's possible of course...

Thank you very much in advance,
Pellens
#2

[eluser]crnalajna[/eluser]
in your /application/config/routes.php
Code:
$route['zomervakantie/(:any)'] = 'lijst/type/zomervakantie/$1';


put .htaccess in website root
Code:
<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /cms

    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    <IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>

</IfModule>
#3

[eluser]Pellens[/eluser]
Thank you very much! It's is working.

One question:
I see that the
Code:
$this->uri->uri_to_assoc()
is not working anymore,
is this normal? It's not a problem, I made a work around, but just to know...

Greetings!
#4

[eluser]crnalajna[/eluser]
It's normal.
You need to use ruri_to_assoc() instead of uri_to_assoc() after routing.
#5

[eluser]Pellens[/eluser]
Thank you very much!
Learned something new again, nice.




Theme © iAndrew 2016 - Forum software by © MyBB