Finding the source of a 301 redirect - php

I have a WordPress website at https://newable.xyz which is fine, if I go to https://newable.xyz/wp-admin I get redirected to https://newable.co.uk/money/financewp-admin.
This is definitely a 301 redirect.
I've tried the following things:
Deleting the redirecting plugin and all of its data
Clearing my browser cache
Using multiple different browsers
Using InPrivate/ Incognito
Using a fresh .htaccess file
Am I missing something obvious?

try search in your active WP theme - wp_redirect or wp_safe_redirect

_search in the theme to see if there is a wp_redirect or wp_safe_redirect as Vasyl said
_deactivate all plugins, both default and mu (a.k.a. mu-plugins) and analyse which one is causing you problems (if there is one that creates conflicts or creates the redirect).
_Try looking in the htaccess file (mod rewrite) of the root, every folder can have its own htaccess. You can have more than one .htaccess file on your hosting account, but each directory or folder can only have one, pay attention.
_Try to see if there is a server configuration (many hosting services have the ability to put a redirect to another domain)
-Delete the wordpress package in case it has been polluted with some injected code and download and reupload it.

Related

Cannot edit pages are migrating wordpress hosting and domain - Error- post.php

I just migrated a Wordpress website to another hosting and domain.
After migration, I'm not able to update pages.
Below is the link of the error I get, when I try to update the page.
I have already increased the memory limit to 512MB and the corrupted htaccess file is also renamed.
It looks like you have placed your .htaccess file in wp-admin folder? Wordpress requires you to keep that in the root folder which is used to redirect post.php. When you access would-admin url it must be opening, while on submit the htaccess is redirecting.
If this is not the case, please share the contents of your htaccess.

Wordpress homepage 301 redirect to localhost

I've just moved a WordPress website from my local machine to the server. All the normal steps were done, such as updating the SQL database and setting it all up. The only problem is the homepage is 301 redirecting to my local URL even though it has the correct URL to go to. The rest of the website is fine including the admin area. So far I've done the following:
Checked the SQL database to look for any localhost URL's
Defined the wp_home and wp_siteurl in the wp-config file
Also defined it in the functions file
Disabled caching
Flushed the permalinks
Disabled plugins
Checked for hardcoded URL's in the PHP
Deleted the .htaccess file and created a brand new one
Any further ideas please?
The solution to the problem was just browser caching, just needed to load it in a different browser which was cache free

Change Startup Page of a WordPress website

I have an installed WordPress website.
I'm working on the site, therefore, I want to show a constructor page for the internet user. I have created a page which called first.html and I change the .htaccess file like below
#Alternate default index page
DirectoryIndex first.html
Now when I enter my domain name on the browser I can see the first.html. This is working properly.
I'd like to see my changes by entering the domain and page name on the browser like
www.mydomain/index.php
or
www.mydomain/wp-content/themes/XXXTHEME/index.php
However, my theme pages don't work.
How can I achieve to do this?
Instead of making changes in .htaccess, I'd suggest you to use this plugin : https://wordpress.org/plugins/maintenance/
Simply name your html file "index.html"
Web servers most commonly parse the index.html file firstly (unless told otherwise) and if it is not found, it proceeds to index.php
This also allows you to simply change that ".html" part to ".php" to see the website you are working on, without installing plugins that clutter your database or making unnecessary changes to your .htaccess file.

Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php

When I try logging in to wp-admin (or even wp-admin/index.php) I simply get redirected to my site's homepage.
(after authenticating successfully - i.e. It DOES accept my login credentials (so its not an account, password or blacklisting issue), but simply wont go to the admin dashboard page after login)
(I suspect it may be an infinite loop that is occurring?? - how do I find out?)
But I CAN login if I go directly to the wp-login.php page, which is weird.
(but this is not acceptable as I need users to be able to login through a custom login page again)
This came about seemingly randomly
(I hadnt changed anything in a week - just woke up one day and couldnt log in)
Preceding factors:
I havent moved the site at all
I havent changed the domain, urls or anything
no cache-ing plugins present
The week before I had:
Updated WP to 4.8
Updated PHP from 5.4 to 5.6
(to allow installation of an SEO plugin add-on - 'SEO framework extension manager')
But it had been working fine for days.
So to given some reporting this after PHP upgrade, I tried setting my PHP back to 5.4, but no luck.
then up to 5.5, and then back up to 5.6 again - still no fix.
I do also have a membership plugin that renames the login page to /login
(But that has worked fine for years too)
I have tried all the usual fixes for wp-admin login issues:
- I have tried multiple browsers, and cleared their cache and cookies - no fix.
- I have disabled every plugin one by one (via ftp folder rename) - no fix.
- even re-updated WordPress to 4.8 again (in case any of the core files needed replacing)
checked file and folder permission are all correct (644) via FTP - all fine - no fix.
I have tried adding lines to the wp-config.php file - with no luck
Such as
define('WP_HOME','https://warrenmaginn.com');
define('WP_SITEURL',... etc.
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
even this solution offered at kinocreative:
#define('ADMIN_COOKIE_PATH', '/');
when I remove the htaccess file altogether, still no fix
(but I do actually get a 404 error page whenever I try access any other page than the root domain, when I dont have the htaccess in place)
(which may mean something in the htaccess i needed to correctly link in my site - but my htaccess hasnt changed, and if I edit it down just to the canonical rewrites (I use SSL sitewide, and do not ever use www in any references to my domain (have checked across database etc.)
I have tried inserting the text "die(FILE':'.LINE);" on every line of the wp-admin/index.php file
(to trouble shoot it - and it stopped (without redirecting) even after placing the line all the way at the bottom of the file - so I imagine this means the issue is not in this file)
Any other files I should try this in?
Or debug modes I can use track this down?
Any suggestions would be VERY appreciated
(this is doing my head in)
Thanks in advance for offering your wisdom...
Warren,
First of all, delete the codes you inserted in your wp-config.php. Instead, put it before your the require_once(ABSPATH . ‘wp-settings.php’):
define( 'WP_HOME','http://warrenmaginn.com' );
define( 'WP_SITEURL','http://warrenmaginn.com' );
define( 'TEMPLATEPATH','/home/MYUSER/public_html/wp-content/themes/MYTHEME' );
define( 'STYLESHEETPATH','/home/MYUSER/public_html/wp-content/themes/MYTHEME' );
If your website uses SSL, don't add any rules to wp-config or htaccess because it may result in 500 internal server error. To force the use of SSL, install "Really Simple SSL" and clear your htaccess, leaving only the necessary:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Now, go to your php settings and set error_reporting as "E_ALL" and verify what the logs says (if you want to fix it by the hard way).
But you can go to your file manager and change the plugin folder name to "plugin.old". It will say if there are any plugins causing the problem. If it is, you could disable each plugin to discover which one is giving you this headache.
If plugins is not the real cause, I'd try to upload a fresh version of your Wordpress (you can find it here ~~ https://wordpress.org/download/). Remember to rename wp-admin and wp-includes to wp-admin.old and wp-includes.old, respectively before unzip the fresh ones. Don't forget to delete all the root folder WP files except wp-config.php.
I'm looking forward to receive your answer.
You have 301 or 302 redirect, do you have some plugins that makes redirects? Or probably it can be written in your .htaccess file.
Was checking a similar issue..
When entering the credentials on wp-admin page it redirected to homepage.
Changed htaccess to default, checked wp folder permissions.. all good.
Found it was a corrupt database. Since I had access to WHM. I used the database repair feature.
Voila!
IT WORKED !!!
For those facing this, you might add a new icognito page and visit again, sometimes its due to caching. if its still not working, might be your htaccess file issue.
I repaired the database through phpMyAdmin, selecting all the tables and choosing repair, and I was able to log in immediately.

Using self hosted Wordpress with a 301 redirect

Recently I've been working to develop a multi-user Wordpress site with Wordpress 3.0 however at the moment we are iso.g one server to showcase preview static content in a subdirectory while multi WP is in the root directory.
My question however is how to keep the root directory hidden from the publc. Curntly I have a PHP index file handling he redirect howevwer as WP has its own index file I waned to ask about any possible alternatives.
Thanks very much for any assistance,
You're probably going to want to do it with an .htaccess file. However, Wordpress has one of those too, so rename the current .htaccess file to .htaccess.orig (or whatever you want... but don't delete it) and then create your new .htaccess file with your 301 redirect.
Then whenever you are done, just rename everything back to the way it was.

Categories