Reputation: 1175
Directory structure (public_html
)
public html
htpasswds
application
.htacess
cgi-bin
system
user_guide
index.php
Configuration file looks like this:
$config['base_url'] = 'http://www.example.com/index.php/';
$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'AUTO';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
.htaccess
file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
route.php
$route['default_controller'] = 'welcome';
Under application->controllers
I have two PHP files, welcome
and about
with methods in them.
Below are the links I am generating, which are
<li><a href='./welcome'>Home</a>
<li><a href='./welcome/first'>first</a></li>
<li><a href='./welcome/second'>second</a></li>
<li><a href='./third'>Third</a></li>
<li><a href='./fourth>Four</a></li>
<li><a href='./five'>Five</a></li>
<li><a href='./six'>Six</a></li>
If I manually type http://www.example.com/index.php/welcome/second
, I can access the page.
But I don't know how to generate the links for the same, and how to get rid of index.php
in the URL.
Upvotes: 0
Views: 1379