无法删除codeigniter中重定向到localhost.com的index.php
问题描述:
i have a project having url
http://localhost/myproject/
naw i have a page that is working
http://localhost/myproject/index.php/about
but i want to change it to
http://localhost/mywesites/about
but it's redirecting me to
www.localhost.com/about
my config.php file is
$config['base_url'] = 'http://localhost/myproject/';
$config['index_page'] = '';
and .htaccess file is
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
我有一个有url的项目 p>
http:// localhost / myproject /
code> pre>
naw我有一个正常工作的页面 p>
http:// localhost / myproject /index.php/about
nn但我想将其更改为 p>
http:// localhost / mywesites / about
code> pre>
但它将我重定向到 p>
www.localhost.com/about
code> pre>
我的config.php文件是 p>
$ config ['base_url'] ='http:// localhost / myproject / ';
$ config ['index_page'] ='';
code> pre>
和.htaccess文件 p>
RewriteEngine on
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteCond $ 1!^(index \ .php | images | robots \ .txt)
RewriteRule ^(。*)$ index.php / $ 1 [L]
code> pre>
div>
答
If you use a RewriteBase in your htaccess like this:
RewriteBase /mywesites/
...does that work?
答
Replace Your .htaccess file with this code and try :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$1 [PT,L]