I am adding some features to an existing web site which was created using CodeIgniter.
We generally use CI's default routing but the former developer of the site, as I see the code, tried to reinvent the wheel.
Usually CI thinks that the routes first parameter is the controller name and the second after slash is function name and trailing parameters are function parameters. But this guy probably didn't know that and the web site is a total mess now. Especially routing logic is awful.
His .htaccess file is as the following:
RewriteEngine on
DirectoryIndex index.php
RewriteRule ^google[0-9a-f]+.html$ - [L]
RewriteRule ^(shop.html)$ index.php?mod=shop&name=$1 [L,NC]
RewriteRule ^(ref.html)$ index.php?mod=ref&name=$1 [L,NC]
RewriteRule ^(refs.html)$ index.php?mod=aff&s=refs&ad=$2 [L,NC]
RewriteRule ^(vip-membership.html)$ index.php?mod=aff&s=top [L,NC]
RewriteRule ^(dds.html)$ index.php?mod=aff&s=dds [L,NC]
RewriteRule ^(news.html)$ index.php?mod=news [L,NC]
RewriteRule ^(document)-(.*)-(.*).html$ index.php?mod=aff&s=document&id=$3 [L,NC]
RewriteRule ^(category)-(.*)-(.*).html$ index.php?mod=aff&s=category&top=$3 [L,NC]
RewriteRule ^(news)_(.*)_(.*).html$ index.php?mod=news&s=detail&name=$1&id=$2 [L,NC]
RewriteRule ^(.*)_news.html$ index.php?mod=news&s=category&catname=$1&id=$2 [L,NC]
RewriteRule ^(page)-(.*).html$ index.php?mod=aff&s=page&name=$2 [L,NC]
RewriteRule ^([a-z0-9_-]+).html$ index.php?mod=page&name=$1 [L,NC]
RewriteRule ^([a-z0-9_-]+).html$ index.php?mod=page&name=$1 [L,NC]
RedirectMatch 301 ^/panel$ /index.php/panel
RedirectMatch 301 ^/2017-books.html$ /dhtc-2017-books.html
php_value max_input_vars 3000
php_value suhosin.get.max_vars 3000
php_value suhosin.post.max_vars 3000
php_value suhosin.request.max_vars 3000
What I want to do is to provide seo friendly urls like controller_name/function_name/$param1/$param2.
I want this .htaccess to work as is, but also it should allow me to write my own urls. For example
RewriteRule ^([a-z0-9_-]+).html$
will do its own work but will not interfere my urls like
$route['download/(:any)/(:any)/(:any)'] = '/controller/download/$1/$2/$3';
I have some routes in routes.php. I don't think they are taken into account.
There's a download method in my controller gets 3 parameter:
$1: folder name,$2: file id and$3: file name
Preventing any confliction how can I add new rules to this .htaccess?