[英]CodeIgniter .htaccess index.php rewrite not working on sub directory level
I am developing a new website by using codeigniter and yesterday I hosted it on a new server. 我正在使用codeigniter开发一个新网站,昨天我将其托管在新服务器上。 It's working perfectly with home page(
landing page URL: http://(domain-name)/(folder-name)
). 它与主页(
landing page URL: http://(domain-name)/(folder-name)
)完美配合。 But, if I try to access any other page, it shows: 但是,如果我尝试访问任何其他页面,它将显示:
404 Not Found error "The requested URL /(folder-name)/ Register was not found on this server."
404未找到错误“在此服务器上找不到请求的URL /(文件夹名称)/注册。”
URL: http://(domain-name)/(folder-name)/Register
I am using routes.php
so, 我正在使用
routes.php
,
Register = 注册=
$route['Register'] = 'register/index';
I already changed index.php
to 我已经将
index.php
更改为
$config['index_page'] = '';
and changed 并改变了
$config['uri_protocol'] = 'AUTO';
and my .htaccess
is 我的
.htaccess
是
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ folder-name/index.php?$1 [L]
Please help me to solve this issue. 请帮我解决这个问题。 Thanks and Regards
谢谢并恭祝安康
Try below lines by clearing your .htaccess. 通过清除.htaccess尝试以下几行。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [QSA,L]
</IfModule>
It worked for me. 它为我工作。 Hope so will solve your problem as well.
希望如此也能解决您的问题。
Try to edit the htaccess file using the following link 尝试使用以下链接编辑htaccess文件
http://addictors.in/remove-index-php-from-url-in-codeigniter/ http://addictors.in/remove-index-php-from-url-in-codeigniter/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.