I have an issue with .htaccess codeigniter on our website (www.jp.com => first project) I just recently built a new project and i set and accessed by an aliased link. (www.jp.com/pt => second project).
A path looks like this : first project : /var/www/jp second project : /var/www/pt
The problem, if i access this url : "www.jp.com/pt" it's works, but.. if i access others controller, eg: "www.jp.com/pt/news" where i'm not set a controller as a default controller, the page shown 404 not found.
And then,i try using index.php like this, "www.jp.com/pt/index.php/news" It's works..
Can anyone help me to fixing this ? i'll can access my alias link without index.php
I using CI 2 & PHP 5.3
Here is my code (mixed from many references :D )
Current .htaccess :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|public)
RewriteRule ^/(.*)$ http://www.jp.com/$1 [NC,L,R=301]
My Config.php :
$root = "http://".$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = "$root";
$config['index_page'] = '';
Thank you...
The .htaccess RewriteBase in the codeigniter second project directory should say /pt/
RewriteBase /pt
Otherwise the rewrite to index.php ends up going to first project router.
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.