php - Shortening URL in Code Igniter -


i working on codeigniter framework website. uploaded website , works. want make kind of secret url shortcut several people know still easy remember. want make www.mywebsite.com/secretpage load secret page. codeigniter doesn't seems allow direct access files. heard can use url routing using .htaccess doesn't seems work.

use codeigniter routes http://ellislab.com/codeigniter/user-guide/general/routing.html can shorten urls. add url helper autoload.

you can't direct access php because code @ top of controller blocks it.

example why can not direct access.

<?php if ( ! defined('basepath')) exit('no direct script access allowed'); 

how shorten routes example.

www.yourdomain.com/secretpage/

$route['secretpage'] = "folder/controller/index";  $route['secretpage'] = "folder/controller/index"; 

also use htaccess

options +followsymlinks options -indexes directoryindex index.php rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa] 

remove index.php config file.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -