[英]How to hide browser URL using codeigniter
Question:题:
How to hide browser URL using codeigniter?如何使用codeigniter隐藏浏览器URL?
My Current URL:我的当前网址:
http://localhost/civicsoft_local/index.php/civic_soft_control/login?state=0
Expected URL:预期网址:
http://localhost/civicsoft_local/
CodeIgniter .htaccess file content as follows: CodeIgniter .htaccess 文件内容如下:
RewriteEngine on RewriteCond $1 !^(ci_civic_soft\index\.php|images|robots\.txt) RewriteRule ^(.*)$ ci_civic_soft/index.php/$1 [L]
you need to enable Query Strings check this http://ellislab.com/codeigniter/user-guide/general/urls.html你需要启用查询字符串检查这个http://ellislab.com/codeigniter/user-guide/general/urls.html
if you need to more check this http://www.web-and-development.com/codeigniter-remove-index-php-minimize-url/如果你需要更多检查这个http://www.web-and-development.com/codeigniter-remove-index-php-minimize-url/
Edit Query Strings in config file .在配置文件中编辑查询字符串。
$config['enable_query_strings'] = FALSE;
In route change your default URL在路由中更改您的默认 URL
$route['default_controller'] = "civic_soft_control/login/0";
Make sure you havemod_rewrite
installed and enabled and put this in your .htaccess file:确保您已安装并启用
mod_rewrite
并将其放入您的 .htaccess 文件中:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
In your applicaiton/config/config.php
file make sure it has this:在你的
applicaiton/config/config.php
文件中确保它有这个:
$config['uri_protocol'] = 'REQUEST_URI';
Ensure that in your .htaccess file you have the below.确保在您的 .htaccess 文件中有以下内容。
RewriteEngine on
RewriteBase /
Now in your config.php file you want to ensure that you have the below现在在你的 config.php 文件中你要确保你有以下内容
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
Finally in your routes file you have to map the shortened version of the url to the controller/function.最后,在您的路由文件中,您必须将 url 的缩短版本映射到控制器/函数。
$route['default_controller'] = 'civic_soft_control/name_of_funtion';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.