CodeIgniter:.htaccess 文件的放置
CodeIgniter: Placement of .htaccess file
我正在尝试配置 CodeIgniter 并从 URL 中删除 index.php
。我将 .htaccess
文件放在应用程序文件夹中,并尝试了用户发布的各种代码。但它没有用,index.php
仍然存在。该文件最初位于 config
文件夹中。谁能帮我解决这个问题?
欢迎所有建议....
提前致谢...
转到 application/config/config.php 并编辑下一步:
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
至:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
如果这不起作用,请 post 您的 .htaccess 文件内容。
您唯一应该编辑的 .htaccess 是放在您网站根目录中的那个(或者您的 index.php 文件所在的任何地方)。
您的 .htaccess 应该包含:
RewriteEngine on
RewriteCond !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/ [L]
同样在您的 config.php 中将 $config['index_page'] 设置为空 :
$config['index_page'] = '';
查看文档:https://ellislab.com/codeigniter/user-guide/general/urls.html
试试这个:
RewriteEngine On
RewriteBase /projects/hc/homecare/trunk/homecare
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond !^(index\.php|images|robots\.txt|css|docs|js|system)
RewriteRule ^(.*)$ /projects/hc/homecare/trunk/homecare/index.php?/ [L]
您应该将 .htaccess 文件放在您的根目录中,而不是在应用程序文件夹中。
在您的 .htaccess 文件中保留以下几行并将其保留在您的根目录下 directory.It 应该可以使用和不使用 index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]
我正在尝试配置 CodeIgniter 并从 URL 中删除 index.php
。我将 .htaccess
文件放在应用程序文件夹中,并尝试了用户发布的各种代码。但它没有用,index.php
仍然存在。该文件最初位于 config
文件夹中。谁能帮我解决这个问题?
欢迎所有建议.... 提前致谢...
转到 application/config/config.php 并编辑下一步:
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
至:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
如果这不起作用,请 post 您的 .htaccess 文件内容。
您唯一应该编辑的 .htaccess 是放在您网站根目录中的那个(或者您的 index.php 文件所在的任何地方)。
您的 .htaccess 应该包含:
RewriteEngine on
RewriteCond !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/ [L]
同样在您的 config.php 中将 $config['index_page'] 设置为空 :
$config['index_page'] = '';
查看文档:https://ellislab.com/codeigniter/user-guide/general/urls.html
试试这个:
RewriteEngine On
RewriteBase /projects/hc/homecare/trunk/homecare
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond !^(index\.php|images|robots\.txt|css|docs|js|system)
RewriteRule ^(.*)$ /projects/hc/homecare/trunk/homecare/index.php?/ [L]
您应该将 .htaccess 文件放在您的根目录中,而不是在应用程序文件夹中。
在您的 .htaccess 文件中保留以下几行并将其保留在您的根目录下 directory.It 应该可以使用和不使用 index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]