Wordpress wp-login undefined redirect - wordpress

After moving a wordpress installation from a remote server back to my localhost I ran into a problem I cannot seem to fix.
downloaded all files and the database
changed url's in the options db table
changed the .htaccess to run in the right directory
For some reason, when I now go to the WP admin directory and I try to login, after I press the login button it redirects to /wp-login.phpundefined/. Note the undefined behind the wp-login.php. It, of course gives a 404 page. I'm also not logged in, when I go to the WP admin again I still need to login. The code of the login has the right form action, so it happens somewhere in the process of the login script.
Anybody any idea what might cause this? Cheers!

Edit your wp-config.php to force the domain your WP installation is on.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
If that doesn't work, use the Fine and Replace tool that will replace all instances of your site's URL from your old database to your new site URL.
i.e. Find and replace.
http://localhost/
to
http://example.com/

wp-login.php can be used to (re-)set the URIs.
Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
// FIXME: do comment/remove these hack lines (once the database is updated).
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );

Related

Wordpress - Changing Wordpress in Place to a New Domain

I have Wordpress install at
scottmollon.com/williammessner-loebs
The files are in public_html/williammessnerloebs
But we wanted to get him his own domain.
So I got bloebs.com, and set it up as an Add-On Domain with my host provider (A2 Hosting).
I configured bloebs.com to point to /public_html/williammessnerloebs
So if you go bloebs.com you correctly see the wordpress site.
But if you click on a post it takes you to scottmollon.com/williammessnerloebs/2019/10/10/appearances/
for example.
I'd like to have all the urls be bloebs.com urls.
I tried changing the site url and home url in my Wordpress general settings, but that just breaks everything. Pages load with no formatted or styled content or images. I've fixed it by editing those urls back to scottmollon.com urls in my database.
Is there anyway I can accomplish what I hope to do?
The first step you took was the right. But there is some more to do:
Change your site url and home url. You can do this in the backend in general settings, or you can edit your wp-config.php file and add (maybe you have https):
define( 'WP_HOME', 'https://bloebs.com' );
define( 'WP_SITEURL', 'http://bloebs.com' );
Log into your backend (you will be logged out at first) and go to your general settings to check if the new url is set. Also go to "permalinks", make your choice and hit save.
Install a Plugin to overwrite the urls in your database, like https://wordpress.org/plugins/go-live-update-urls/ In this plugin you just need to enter your old wordpress url and then your new url. You do not need to overwrite plugin files, so keep that unchecked.
After that, everything sould be working fine. You can delete the plugin again, because you don't need it anymore.
If you have any urls in your theme files, that you are not getting dynamically but have inserted them by hand, you have to edit this by hand. The Plugin "Go live..." will only overwrite the urls in your database.
Hope this helps you out.

ERR_TOO_MANY_REDIRECTS error in wordpress wp-admin login

I am using WordPress 4.9.2 and have followed all the steps for installation.
Now, once the installation finished I tried to login using entered credentials.
But its redirecting me to same wp-login.php page again and again.
I tried 'Lost your password?' option but haven't received any email yet.
Also, since my website uses SSL, I entered 'siteurl' and 'home' values with 'https://example.com/blog' but it doesn't even load wp-login.php then and as soon as I change it to 'http://example.com/blog' it loads the login page but after submission get redirected to same page.
Below are the few things I tried to get it resolved.
added below code in wp-config.php
define('FORCE_SSL_ADMIN', true);
disabled all plugins by renaming plugin folder
removed .htaccess file
restored default .htaccess file
added below code in wp-config.php
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
changed wp-login.php permission to 644
After every change , have cleared cache, cookies and checked again but no success.
If "your" SSL cert is provided by say an intermediate e.g. a CDN: Then the intermediary might be passing a "non-standard" 'HTTP_X_FORWARDED_PROTO' value e.g. uppercase "HTTPS" .
Alter your wp-config check of 'HTTP_X_FORWARDED_PROTO' to cater for these possibilities e.g.
if (stripos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
first of all, try to find the bug comes from.
1. take backup of DB & then drop all tables.
2. re-install WordPress by remaining all files as it is.
--> if still shows the same issue then the problem comes from file structure.
&
if it works correctly then the issue comes from DB for URL mismatch.
Give your feedback about issue tracing process, so I can suggest you an accurate solution.
similary i tried all the solutions like :
clearing browser cache
editting .htaccess and adding below lines
define ('WP_SITEURL', 'https://example.com');
define ('WP_HOME', 'https://example.com');
renaming plugins
but none worked for me.
check your SSL if you are using cloudflare.
i was having problem accessing the dashboard by ftp filezilla , so i used my hosting providers cpanel.
fianlly , by putting the below code in wp-config.php worked for me.
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on'; ``
I hope it helps, thank you.

How to update get_stylesheet_directory_uri in wordpresss

How do I update get_stylesheet_directory_uri? Transferring a website and I have already updated the url for the site inside wp-config using:
define('WP_HOME','https://somewebsite.com');
define('WP_SITEURL','https://somewebsite.com');
Still when get_stylesheet_directory_uri is called it is using a previous url, any idea on how to force this to update?
Thanks!
Once you change the site URL using those DEFINE statements, you also need to flush the permalink settings. Just go to wp-admin -> Settings -> Permalinks, and save without making any changes. That should force it to use your new values.
If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor and upload it back to the site.
Add these two lines to the file.
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Use your own URL instead of example.com, obviously.
Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly; if you can use that, do so.
Load the login or admin page a couple of times. The site should come back up.
Another thing that can happen if your site is multilingual is that get_stylesheet_directory_uri is used in a registered string whose translation is still using the previous domain. In that case, search and replace your translations with the new domain.

Wordpress on HTTPS

I've recently moved my website over to https:// and have re-installed WordPress to this new platform.
The SSL certificates are installed correctly in the appropriate directories. The certificate installation has been completed by my web hosting supplier. The wordpress installation is in a sub directory of the root https://www.mysite.co.uk/blog/. So far so good.
The normal website pages (which are external to WordPress) all function as required and normally merge posts from the blog, which appear in the page footer and in sidebars. These are currently suspended pending resolution of the WordPress issue.
The issue that I'm experiencing is simply that I cannot log in to WordPress. The admin log in panel at https://www.mysite.co.uk/blog/wp-login.php is displayed, however, when entering the correct username and password combination the wp-login.php simply goes through a loop but doesn't allow me to login irrespective of password and username combination.
Here's what I've tried:
I've changed the appropriate lines in wp-config.php to force an SSL login:
After WP_DEBUG in wp-config.php I added the following lines:
define( 'FORCE_SSL_LOGIN', true );
define( 'FORCE_SSL_ADMIN', true );
But with no result. Does anyone know what the potential issue might be?
Please try this code in wp-config.php
define('WP_HOME','https://www.mysite.co.uk/blog/');
define('WP_SITEURL','https://www.mysite.co.uk/blog/');

wordpress redirect loop on the login page (wp-login.php)

I am working on a wordpress site (3.0.1) everything was ok. now i can't login to my admin BO.
I have a endless redirection !
I have tried this :
cleaning cookies, disable plugins...
I have added :
#define('ADMIN_COOKIE_PATH', '/');
On wp-config.php, but nothing changes .
Can you help please ?
Thanks
You can try these steps.
Log in to wordpress database using phpmyadmin.
go to wp_options table and go to page two.
Remove active plugins.
If you have a backup of the old database paste the plugins back in. OR
1) Backup your .htaccess file on your hard drive
2) Delete the .htaccess file from the root of your server
3) Go to your blog’s admin panel and log-in
4) On the left sidebar, go to Settings –> General and changes your WordPress Address and Blog Address to include www (so it should be http://www.domainname.com instead of http://domainname.com).
5) Save Settings
6)Take your .htaccess backup and reupload it to the root of your server/directory
this was a server restriction with the firewall! Thanks

Resources