WordPress.org

Forums

Url problem / wp_3_options table change (23 posts)

  1. viebone
    Member
    Posted 2 years ago #

    Hello,

    I have mysite.com and mysite.com/en, but if I login into the admin, the url of the second blog change to mysite.com.

    I don't know what is going on.

    Any clue of what can I do or what could be happening????

    Thanks!

  2. What's in your .htaccess?

  3. viebone
    Member
    Posted 2 years ago #

    Hello,

    Thanks for your help, I am completely desperate.

    If I am honest I don't know what I am doing exactly with this .htaccess.

    Thanks

    # canonical redirect to no www
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    
    # END WordPress
  4. For a quick test, remove the canonical redirect you have for www.

  5. viebone
    Member
    Posted 2 years ago #

    Hello,

    I have removed the canonical redirect and at the moment it is working good.

    I made some test, changed a few post and all seems to work fine.

    Do you think this was the problem??? What a canonical www redirect means???

    Thank you so much for your help!

  6. The canonical redirect forces your domain to use domain.com instead of http://www.domain.com

    The problem was that you wrote it wrong. If you want to use that, it should be this:

    RewriteCond %{HTTP_HOST} ^www\.domain\.tld$ [NC]
    RewriteRule ^(.*)$ http://domain.tld/$1 [R=301,L]

    The way you wildcarded it breaks on WP due to it's rules.

  7. viebone
    Member
    Posted 2 years ago #

    Hi,

    Today it happened again, The url of the second blog have changed and now both have the same url.

    It's to weird no??? I removed the canonical redirection as you told me but it's happening again.

    if I go to mydomain.com or http://www.mydomain.com I can see the website and I removed the canonical redirection.

    What should I do????

    Thanks you very much!

  8. Are you being redirected to one URL or the other, or are BOTH working?

  9. viebone
    Member
    Posted 2 years ago #

    Both are working, if I point my browser to mydomain.com/en the site its working but if I go to the admin > mysites, both are redirecting to mydomain.com

    If I force in the browser mydomain.com/en/wp-admin, I can access to the second blog admin.

    The only think that is changing it's the field siteurl of the table wp_3_options in my data base.

    In this row of the db, the url have to be http://www.mydomain.com/en, but sometimes, wordpress remove the /en and leave http://www.mydomain.com

    It is a problem because I am using the fuction site_url() in my theme to get content depending on the language, and when wordpress change the url and remove the /en the website throws a few errors.

  10. By 'working' do you mean http://www.domain.com/en works AND domain.com/en works, or only one?

    See, WordPress needs to be one or the other. Having both is problematic.

  11. viebone
    Member
    Posted 2 years ago #

    If you go to http://mysite.com/en or http://www.mysite.com/en you get the same page and no errors, you can see the page.

    What I can not understand it's why wordpress change the url in the data base.

  12. Okay, so both www and non-www works. Amd that's a problem.

    You should only use ONE. One should redirect to the other. So domain.com/en should magically redirect to http://www.domain.com/en (or vice versa, it depends which you used when you setup the site).

    What I can not understand it's why wordpress change the url in the data base.

    Sorry what? Did you change something in the DB?

  13. viebone
    Member
    Posted 2 years ago #

    Well my main problem is that wordpress, not me, automatically change the url of my second blog in the database.

    I have to blogs: myblog.com and myblog.com/en

    well, I don't know why but when I login into the admin wordpress changes the url of the secondo blog to myblog.com, removing the /en string at the end.

    Each time it happens I go to the database, find the table wp_options of the secondo blog and I see that the field siteurl was changed to mydomain.com. If I want my blog work again I have to go to my database and change it be my self.

    I don't know what its happening

  14. Well my main problem is that wordpress, not me, automatically change the url of my second blog in the database.

    No. WordPress will not do this. A plugin might, or you may have done it on accident, but WP doesn't magically flip that over for you. You have something else on your site doing that.

    What plugins are you running?

  15. viebone
    Member
    Posted 2 years ago #

    Hello again, thanks you so much for your help.

    It happens each time I use the admin to create new post, update content etc. After updating I always have to enter in the database and change the siteurl of the table wp_3_options, which is the second blog options table, and add the "/en" to mydomain.com

    I am using the following plugins:

    - Advanced Post Types Order (http://www.nsp-code.com/)

    - Lightbox Plus

    - Search Everything

    - User Role Editor (http://shinephp.com/user-role-editor-wordpress-plugin/)

    I think all of them are common plugins.

    This weekend I will deactivating them just for to be sure.

    What do you think could be happening.

    Thanks!

  16. I think there's something in your theme or your plugins that's doing this.

  17. viebone
    Member
    Posted 2 years ago #

    Hello, hope you are well!

    After testing my website a few days I know where is the problem but I don't know how to solve it.

    As I told you before, I have a wordpress multisite with to blogs.

    If I go to the admin of the second blog and I click on the LogOut button, wordpress change the url in the db.

    I have mysite.com and mysite.com/en, after logout, the url of the second blog change to mysite.com.

    Each time I logout from the second blog admin I have to go to my phpadmin and change the siteurl field value on the wp_3_options table.

    What the hell I am doing wrong??? jejeje I am getting crazy with this small but anoying problem.

    I have tried to trace the logout process to see if I see where it is the problem but I can't, I have no idea what is going on.

    Do you know what could I do???

    Thanks

  18. If I go to the admin of the second blog and I click on the LogOut button, wordpress change the url in the db.

    Every time you press logout the URL changes?

    You've got to have some hook/action calling that.

    Are you 100% sure you can reproduce this without any plugins turned on?

  19. viebone
    Member
    Posted 2 years ago #

    Hello,

    Yes, every time I press logout button the url changes, but only if I logout from the /en/wp-admin. I mean, when I logout from the second blog admin.

    I have deactivated all plugins in both sites, and nothing, if I press de logout button the url changes on the db.

    It is posible that I did something wrong in my wp-config.php???

    Thanks mate!

  20. I don't think it's your wp-config.php.

    Can you test after renaming the plugins and mu-plugins folders to plugins-old and mu-plugins-old

  21. viebone
    Member
    Posted 2 years ago #

    Hello,

    Bufff, nothing, I have renamed the plugins folder to plugins-old and when I click on the logout button it happens again.

    I don't have mu-plugins-old.

    Well thanks for your help, I don't know what to do. Is there a way to deactivate the logout button in this blog admin????

    Thanks a lot!

  22. If you are up for some command line fu ;) ssh to your server, cd to your WordPress directory and try running this command.

    find . -type f -name '*.php' | xargs -I{} egrep -Hn "update_option\(.*'siteurl|update_option\(.*'home" {}

    On my multi-site installation I get this output.

    ./wp-admin/network/site-info.php:55:                    update_option( 'siteurl', $blog_address );
    ./wp-admin/network/site-info.php:58:                    update_option( 'home', $blog_address );
    ./wp-admin/includes/upgrade.php:53:     update_option('siteurl', $guessurl);
    ./wp-admin/includes/schema.php:521:     if ( !__get_option('home') ) update_option('home', $guessurl);
    ./wp-login.php:376:             update_option( 'siteurl', $url );
    ./wp-includes/ms-functions.php:1155:    update_option( 'siteurl', $url );
    ./wp-includes/ms-functions.php:1156:    update_option( 'home', $url );

    Which I'm pretty sure is normal. If you run that command do you see any other files listed?

  23. viebone
    Member
    Posted 2 years ago #

    Well, after trying different things I couldn't do ssh to my server.

    Finally I have deactivate the logout button for that blog because I am completly desperate.

    I am not use to command line and ssh...

    Anyway, thank you very much for your time and if some day I got an answer I am going to post it here.

    I really appreciate your help,

    Thanks!!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.