繁体   English   中英

CodeIgniter .htaccess index.php重写在子目录级别上不起作用

[英]CodeIgniter .htaccess index.php rewrite not working on sub directory level

我正在使用codeigniter开发一个新网站,昨天我将其托管在新服务器上。 它与主页( landing page URL: http://(domain-name)/(folder-name) )完美配合。 但是,如果我尝试访问任何其他页面,它将显示:

404未找到错误“在此服务器上找不到请求的URL /(文件夹名称)/注册。”

URL: http://(domain-name)/(folder-name)/Register

我正在使用routes.php

注册=

$route['Register'] = 'register/index';

我已经将index.php更改为

$config['index_page'] = '';

并改变了

$config['uri_protocol'] = 'AUTO';

我的.htaccess

RewriteEngine on  
RewriteCond $1 !^(index\.php|public|\.txt)   
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^(.*)$ folder-name/index.php?$1 [L]  

请帮我解决这个问题。 谢谢并恭祝安康

通过清除.htaccess尝试以下几行。

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [QSA,L]
</IfModule>

它为我工作。 希望如此也能解决您的问题。

尝试使用以下链接编辑htaccess文件

http://addictors.in/remove-index-php-from-url-in-codeigniter/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM