Good afternoon community.

Faced a problem whose solutions are looking for the second day. And I will be glad to any useful advice on this issue. And the thing is:

There is a website on wordpress. And its main page is located at www.domain.ru/blog/. I know that this is not the best solution - to place the main page at the address in this form, but this is 1) the site is not mine and 2) the blog is stored on a separate site www.domain.ru hosting.

All entries of this blog are available on the links like www.domain.ru/blog/post-name/

But strange begin at the entrance to the admin area.

The admin button refers to the address www.domain.ru/blog/wp-admin/ When I click on the button, I go to the admin’s main page. And in the address bar of the browser, the address www.domain.ru/blog/wp-admin/ first appears and quickly changes to www.domain.ru/wp-admin/. That is, the word / blog in the URL disappears.

And this leads to the fact that the rest of the links on the administration panel also take the form of www.domain.ru/wp-admin/settings-page/, when switching to which error 404 occurs.

I checked that if I tried to go to the link like www.domain.ru/blog/wp-admin/settings-page/, then everything happens correctly.

In connection with the lack of ideas to solve the problem, I appeal to you for advice. The ultimate goal is to make the admin panel work properly and generate links on the admin panel like www.domain.ru/blog/wp-admin/settings-page/ on buttons and forms.

UPD: content .htaccess

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php </IfModule> # END WordPress AddDefaultCharset utf-8 AddType 'text/html; charset=utf-8' .html .htm .shtml 

Thank you in advance.

  • one
    Did you search the database tables for the string "www.domain.ru"? Maybe somewhere in wp_options the wrong url of the site is stored - alenkins
  • one
    Well, in wp-config.php you can still look at what is set for WP_HOME and WP_SITEURL - alenkins
  • one
    You can look inside .htaccess . In general, you would list what you have already checked to understand what has already been verified - alenkins
  • one
    I have quite a lot of WordPress sites in one domain directories. The content of .htaccess something like the following screencast.com/t/LX5jx0ASf Note RewriteBase and RewriteRule - alenkins
  • one
    As far as I know, editing with this file in the case of WordPress almost always ends in failure. and tried to remove it and re-save the permalink settings in the wp admin panel (change a couple of times)? WordPress will have to create .htaccess in a new way, taking into account all the current url settings. just make a copy of the worker . Htaccess necessarily - alenkins

1 answer 1

In a very extreme case, if you do not find the reason, then try to bypass the error, for example, by adding a filter on login_redirect and logout_redirect :

 function login_redirect($redirect_to, $request, $user){ return home_url('/wp-admin/'); /* или задайте адрес совсем константой, если home_url() возвращает неправильный url */ die(); } add_filter('login_redirect', 'login_redirect', 10, 3); add_filter('logout_redirect', 'login_redirect', 10, 3);