Local valet wordpress site redirects to real site - wordpress

I used to use MAMP to locally host my wordpress website and it worked fine.
I recently started doing Laravel development so I use homebrew and valet. (which apparently interfered with MAMP because it stopped working, I'm still new to that whole area, so now I have to use wordpress with valet)
I was able to connect to my website using mysite.dev and I could see the homepage but without any date because the database was empty. Then I imported my database and now when I use mysite.dev in any broswer, it redirects me to www.mysite.ca (the actual website and not the local one).
I did do the command valet park in my wordpress repository.
How can I possibly fix this ? I suspect it's some setting in wordpress but I can't even access my local wp-admin.

You might try adding the following to your wp-config.php file.
define('WP_HOME','http://mysite.dev');
define('WP_SITEURL','http://mysite.dev');
This forces WordPress to recognize your current domain.

Related

Cloning wordpress live site to localhost (mamp) - redirect to live site

I am new in this and I am struggling with cloning a WordPress live site to localhost for development. After reading many different tutorials, I finally succeeded to clone the live site to localhost (http://localhost:8888) but when I try to login into the WordPress admin area at first it did not open at all but after trying a few times it opened but redirected to the live site.
I changed the URLs in phpmyAdmin but I always have the message "0 rows affected". I changed the URL in wp_config.php.
define('WP_HOME','http://localhost:8888');
define('WP_SITEURL','http://localhost:8888');
After this in phpMyAdmin inside my database --> wp_options I changed the site URL and home with the new localhost URL http://localhost:8888.
Nothing of these is working. What am I missing?
I recommend to make a clone by some plugin (f.e. Duplicator). It will makes for you all of the stuff like changing the url in DB, and if is anywhere a problem it gives you error report.
You can install Duplicator, make a full copy of you website (just clicking next...next), after that download it to your PC (or devie where is localhost). After that, run the downloaded php file and complete the DB login. After that, if you have correct DB with correct login credentials you should have running website copy on localhost.
More details you could find in this video: https://youtu.be/NLYyecIXOU0

Wordpress Add "login/?msg=membershipRequired" to my URL

I have a website (built using wordpress) running in host server. I am trying to run my site in local machine. I install xampp, copy of my sites files, and export/import my database to local apache server.
However, when I am trying to open http://localhost/inj/public (/inj/public contains all wordpress files and folders), the url changes to "http://localhost/inj/public/login/?msg=membershipRequired" and the page shows "Object not found!".
I have changed my site and home url from wp-options table. But the problem is still there.
Any help?
Maybe you are using WooCommerce and have a restriction accidentally added? Have found something about it here: https://docs.woocommerce.com/document/woocommerce-memberships-settings/

Migrating Site To Digital Ocean and having trouble with redirecting to HTTPS

I am migrating my site to digital ocean and I am having an issue with Https. I have moved the directory and the apache2 config file and mysql database. I believe I set everything up correctly but now I want to test it. I have edited my /etc/hosts file with my new ip and sitename.com. However when I try to go to my browser and look to see if the site works it keeps trying to redirect me to the https version of my site.
I have tried going to chrome://net-internals/#hsts and deleting the site but it still redirects to https. How can I test my site without being redirected to the still hosted version of my site?
Thanks!
Aside of the wp_options field, WordPress stores lot's of links 'hard-coded' which all will contain the https. You would need to do a full search and replace on the database, but be aware of serialized stuff. To to safely perform a search and replace you could use a program found on: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Works like a charm.
Another way is by using wpcli if you have commandline access and wpcli is available. From the command line go to your root directory (containing the index.php) and type:
wp search-replace https://www.your-domain.example http://www.your-domain.example
Or type:
wp search-replace https://your-domain.example http://your-domain.example
Based on your setup up course.
Always make a full backup of your database before performing these actions, so you can restore if any problems occur.

301 redirect error with wordpress and apache

I've recently migrated a database from windows using bitnami (apache and wordpress) to a linux server (apache and wordpress). I'm able to access the website wp-admin, but every time I try to access the main site it repeatedly returns 301 errors.
I've tried disabling the .htaccess file (deleting, commenting everything out), but it still gets directed. I've disabled all plugins. I've looked into the themes I'm using but they don't have redirect url's like I've seen in other posts.
I'm wondering if the issue might be in how bitnami structures itself. the main documents are stored in website/wordpress/htdocs, whereas linux wordpress seems to store it directly in wordpress.
I've set sites-enabled home directory to
sitelocation/wordpress/htdocs
I've also set the wordpress address and site address to
http://website.com:80
What do I need to do to prevent the redirects, or set it up to work correctly?
if you haven't change your Site URL then.
Please change the Site URL and Home URL from database in wp_option table.
You need to mention new url in both section..
I had a trailing / on my siteurl which led to it not working. After removing that it worked.

How to restore local wordpress server from cash?

I'm fairly new to development and have been trying to create my own wordpress theme. While editing the theme today I made a mistake in the code and now the wordpress page won't load at all. It's just a white page and I can't even access wp-admin. I have wordpress installed locally with Bitnami.
I've researched how to fix this wordpress crashing problem and everyone keeps saying with FTP. But with a local server, from as far as I can tell, I don't think that works. I'm using Cyberduck and have tried to enter the IP address of the local server wordpress site to access the files but Cyberduck doesn't pull anything up. I have also tried stopping the server and starting it again and this doesn't help.
How do I recover my wordpress site from a crash when it's stored on a local (Bitnami) server?

Resources