I downloaded a old webpage from webserver. now i am redesign all pages. while testing the links get back to localhost content page. but it works fine in web server.
in localhost index page works fine but from index page links are not working. while click links the url shows fine like
http://localhost/sitename/site/index
anchor code in home page is :
<?php echo anchor(base_url().'site/index','Home','class="header"');?>
in config.php
$config['base_url'] = 'http://localhost/sitename/';
$config['index_page'] = '';
in controller (site.php):
class Site extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->helper('form');
$this->load->helper('html');
}
public function index()
{
$this->load->view('site/home');
}
}
.htaccess page on www/site-folder-name
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
if u want any other detail i will give u....
Modify your Htaccess
RewriteEngine on
RewriteBase /project_name
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.