php - CodeIgniter URL not found -


enter code herei got code in .htaccess file:

rewriteengine on rewritebase /projfolder  ### canonicalize codeigniter urls  # if default controller other # "welcome" should change rewriterule ^(mycontrol(/index)?|index(\.php)?)/?$ /  [l,r=301] rewriterule ^(.*)/index/?$ $1 [l,r=301]  # removes trailing slashes (prevents seo duplicate content issues) rewritecond %{request_filename} !-d rewriterule ^(.+)/$ $1 [l,r=301]  # enforce www # if have subdomains, can add them  # list using "|" (or) regex operator rewritecond %{http_host} !^(www|subdomain) [nc] rewriterule ^(.*)$ http://www.domain.tld/$1 [l,r=301]  # enforce no www #rewritecond %{http_host} ^www [nc] #rewriterule ^(.*)$ http://domain.tld/$1 [l,r=301]  ###  # removes access system folder users. # additionally allow create system.php controller, # not have been possible. # 'system' can replaced if have renamed system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php/$1 [l]  # checks see if user attempting access valid file, # such image or css document, if isn't true sends # request index.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] 

my project in /var/www/projfolder -> structure in folder is

/application /system /user_guide .htaccess index.php 

i changed $route['default_controller'] = "mycontrol"; in config routes.php file. if type url localhost/projfolder/ load default mycontrol.php controller , index function controller. if go localhost/projfolder/myfunction -> meaning want load myfunction default controller gives me "the requested url not found on server." can help? thanks.

open config/routes.php file

add line:

$route['mycontrol/(:any)'] = "mycontrol/index"; 

then never used huge .htaccess codeigniter, use , works great:

rewriteengine on rewritebase /projfolder rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /projfolder/index.php/$1 [l] 

to remove index.php have use htaccess , change in config/config.php:

$config['index_page']=''; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -