Good day! please tell me, after transferring the site to another hosting, a little problem appeared

There is a folder mysite.jp/backend - admin panel, it has a file. Htaccess

RewriteEngine On

RewriteCond% {REQUEST_FILENAME}! -F

RewriteCond% {REQUEST_FILENAME}! -D

RewriteRule ^ (. *) $ Index.php? $ 1 [L]

In fact, this .htaccess converts url (a question mark is added after mysite.jp/backend/)

mysite.jp/backend/users/girls/menu/100010 in

mysite.jp/backend/?users/girls/menu/100010

But with this file you can not log in to the admin address

mysite.jp/backend/index/login

in the chrome debager shows 500 error

Without .htaccess, it is normal to log in, but the links in the admin panel are not converted — accordingly, no transition occurs. If you add a sign with your hands? to the URL in the browser - the link starts running

Help please, add an exception in .htaccess - so that it skips the login process

Thank you in advance!

ps. I do not know how important this is, in the main directory of the site there are such lines in .htaccess

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^/?(.*) http://%1/$1 [L,R=permanent] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> 
  • It shows 500 error - in the error.log apache, what is being recorded? - aleksandr barakin
  • PHP Warning: require(main.php): failed to open stream: No such file or directory in /home/admin/web/mysite.jp/public_html/backend/index.php on line 12 PHP Fatal error: require(): Failed opening required 'main.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/admin/web/mysite.jp/public_html/backend/index.php on line 12 File backend / index.php if($_SERVER['REQUEST_URI'] != '/backend/index' AND $_SERVER['REQUEST_URI'] != '/backend/index/login') { require "../main.php"; } else { require "main.php"; } if($_SERVER['REQUEST_URI'] != '/backend/index' AND $_SERVER['REQUEST_URI'] != '/backend/index/login') { require "../main.php"; } else { require "main.php"; } if($_SERVER['REQUEST_URI'] != '/backend/index' AND $_SERVER['REQUEST_URI'] != '/backend/index/login') { require "../main.php"; } else { require "main.php"; } 12 line - require "main.php"; - caramel ua
  • main.php is in the root of the site folder /home/admin/web/mysite.jp/public_html/ - caramel ua
  • Clearly, in this direction you should not dig. now add the answer. - aleksandr barakin
  • **** many thx) **** - caramel ua

1 answer 1

after discussions and attempts to recreate the situation, I came up with this option:

 RewriteEngine On rewritecond %{REQUEST_URI} ^/backend/index/ rewriterule ^(.*)$ /index.php [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L] 

differs from your version by two added lines.

  • added - now by the login link mysite.jp/backend/index/login error 404 - caramel ua
  • and if now "add a question mark"? (in which position, by the way, do you enter it?) - aleksandr barakin
  • Ltd! Now it works a little crookedly if you add? Login. - caramel ua
  • Now I will try to describe the situation. Thanks a lot! - caramel ua
  • in the sense of "add? login"? What exactly is the url working? - aleksandr barakin 8:04 pm