URL重定向到.Htaccess不';不能在Php Codeigniter中工作
我想知道,当我输入localhost/projectname/index.html时,它将重定向到URL重定向到.Htaccess不';不能在Php Codeigniter中工作,.htaccess,codeigniter,url-rewriting,.htaccess,Codeigniter,Url Rewriting,我想知道,当我输入localhost/projectname/index.html时,它将重定向到 http://localhost/service/welcome/index 为此,我将其写入.htaccess,但它不起作用 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.
http://localhost/service/welcome/index
为此,我将其写入.htaccess,但它不起作用
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Redirect /index.html http://localhost/service/welcome/index
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
重定向/index.htmlhttp://localhost/service/welcome/index
我该怎么做呢?在codeigniter中,URL中没有文件在调用。Codeigniter所做的就是使用MVC结构来渲染视图 如果您访问根文件夹(index.html或index.php)上的任何内容,它也会重定向到应用程序文件夹。然后默认控制器被触发 cz在根目录中有文件调用
index.php
,您可以看到
$application_folder = 'application';
$system_path = 'system';
你可以看看这个
config/routes.php
controller/
model/
view/
.htaccess
删除URL中的index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
里面没有重定向选项?那么我如何重定向或触发它?重定向什么??我们使用.htaccess删除url中的index.php我想在url中写入localhost/projectname/index.html时,它会转到主控制器和索引操作它如何确保此url请求转到主控制器和索引操作
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';