简体   繁体   中英

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. It's working perfectly with home page( 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."

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

I am using routes.php so,

Register =

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

I already changed index.php to

$config['index_page'] = '';

and changed

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

and my .htaccess is

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.

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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