Htaccess does not redirect to codeigniter

I am new to php and codeigniter.i working on a project that runs on the server abcd.comand I use htaccess code like this

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

now my project has been transferred to another server 192.000.000.000.I can access the login page when the user logs in, becomes installed and redirects to 192.000.000.000/myproject/user, and here I get an error 404

i was set base_url in config.php as shown

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']); 

$config['index_page'] = '';

my WINSCP project structure

old one :  /home/my_org/public_html/prjFolder
new one :  /var/www/html/prjFolder

My .htaccess file like this

system/
application/
user_guide/
index.php
.htaccess

If anyone finds a solution, please help me ..

+4
source share
3 answers

, apache rewrite_module. httpd.conf, .

AllowOverride None AllowOverride All

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Apache putty # service httpd restart

URL: - http://dev.antoinesolutions.com/apache-server/mod_rewrite

0

, . , ​​ AllowOverride ( , Apache -)? , Apache .htaccess. - .htaccess, , , . , .htaccess .

: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

, mod_rewrite ( , Apache). , .htaccess .htaccess, , . , , , URL- : 192.000.000.000/index.php/myproject/user

: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

, .htaccess, , , , .

+2

,

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

URL

192.000.000.000/myproject/user

rewrite

192.000.000.000/index.php/myproject/user

You need to change the rewrite rule to exclude myproject / user from the URL to go to index.php or you can just remove .htaccess if it is only a development machine, the reason we hide index.php is that the URL The address will look beautiful. Having Dev in the environment does not hurt at all.

0
source

Source: https://habr.com/ru/post/1526934/


All Articles