Moving WordPress from Live to Localhost MAMP - wordpress

I am trying to back up my Wordpress website and want to test my website locally, without a SSL certificate. I have installed MAMP but I am facing some problems to make it work.
When I start the apache server and go the localhost, my homepage does show up but the CSS doesn't load and I get a bunch of errors regarding a cache plugin.
But the biggest problem I am facing is that whenever I go to another page, my local website immediately tries to load a HTTPS page and goes to my live website (even when I specifically mention a HTTP link).
I have tried changing the .htacces file with the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
I have also changed the database homepage URL from https to http in wp_options but that only fixed the index page but not the other pages of my website.
My apologies if my question is still unclear, I'm kind of new to this so any help would be appreciated.

Related

non wodpress subdirectory refusing to serve https content

Runnin landing pages in a subdirectory below wordpress install;
public_html/comms
https pages in /comms display but scripts, css and images wont display.
If I remove the s and leave http then they will display perfectly within a https page. How strange.
This only began a few days ago and only happens in chrome.
Works fine with edge and ie.
I need these landng pages to be https and no mixed content because google will penalise my quality score and adds will be more expensive.
I am lost for ideas.
Chrome problem only
In the subfolder only
Any thoughts?
Have you setup forced SSL in the .htaccess file in the subdirectory root?
Add this to the file if it isn't there:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

.htaccess wordpress multisite redirect between subsites

I am building a new site for a client. we preserved the old site in a wordpress multisitesolution. Now it's time to migrate into the new site. Problem is the old site is heavilly embedded in Google Search with many active links. So I need a way to catch and redirect each and every link that comes our way.
I can redirect old.sitename.com to new.sitename.com directly - this works fine. Problem is when I get direct links to posts or pages.
Som this is the syntax I need resolved
old.sitename.com/an-article-read-this --> new.sitename.com/an-article-read-this
I have tried several .htaccess commands, including a few wordpress addons. Even simple ssl with .htaccess redirect enabled.
RewriteRule ^old.*$\% https://hoppla.heiledeg.no/%{REQUEST_URI} [R=302,NC]
direct links keeps opening up in the old site. not the new one.
Yes I have refreshed cache. And even tested on "fresh" browsers.
Any ideas, tips, or even addons are very much appreciated.
for me this was the solution:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(old.)?olddomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

Mixed content - SSL http/https issue

Approximately 2 months ago I installed a SSL certificate on my site, catherinerushforth.com. I changed the site and WordPress URL in the admin area of WordPress to include https:// instead of http://. All was fine.
Then, about 2 weeks ago I started to have a problem with "Mixed Content" errors on all pages except the main home page. There doesn't seem to be an issue when viewing the site with Safari but there is a problem with Chrome, Firefox and Internet Explorer. I inspected the Javascript console in Chrome (as an example) and saw multiple "Mixed Content" errors
This is what I have do so far to try and fix these mixed content errors:
Changed http:// to https:// in the WordPress Admin section for the site and WordPress URLs (Settings/General)
I've added "define('FORCE_SSL_ADMIN', true);" to the top of the wp-config.php file.
I've added the following piece of code to the .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^catherinerushforth.com [NC]
RewriteRule ^(.*)$ https://catherinerushforth.com/$1 [L,R=301]
With this code I get "ERR_TOO_MANY_REDIRECTS"
I've also tried the plugin, WordPress HTTPS (SSL).
None of the above have worked.
Does anyone know what I am doing wrong and/or have any suggestions as to how I can fixed this issue?
Many thanks.
WordPress version: 4.2.2
Theme: X-theme v.4 (although issue was the same in previous version of this theme)
Site: catherinerushforth.com
UPDATE
If I simply remade each page for my site (which I will probably have to do at some point due to X-Theme now using their CornerStone page builder) would this ensure all links were https:// and not http://?
Remove
define('FORCE_SSL_ADMIN', true);
from wp-config.php, be sure you have changed http:// to https:// in WordPress Admin, and then force SSL for front and backends with this in .htaccess above the WordPress rewrite block:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://catherinerushforth.com/$1 [R=301,L]
That only forces SSL; you still need to find the site resources which are loading non-SSL.
So use the developer tools in Firefox (or Firebug) or Chrome or Safari or IE to see the errors with specific site resources.
And:
• you should change URLs of media items and links in the post/page content to https so they don't depend on the redirect in .htaccess. Search RegEx is a good plugin to be able to search and replace (optionally with grep) through all posts, pages, excerpts, comments, titles and meta. And, interconnectit.com WordPress Serialized PHP Search Replace Tool can be used to find/replace in the entire database, i.e. metadata, GUIDs and widget content, etc.
• You may need to change to a relative path for images in CSS files, i.e. background-image: url(http://example.com/themes/wp-content/theme/images/image.jpg) to background-image: url(images/image.jpg)
• You may need to remove the http from absolute paths in php theme files, i.e. change 'http://example.com/image.jpg' to '//example.com/image.jpg'; that will allow your resources to default to https.
RewriteEngine On
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Source
So I had this issue on image urls being returned as http://https://website.com/image.jpg. What I did was use the Velvet URL plugin to rewrite the urls for all content from http://https://websiteurl to https://websiteurl. This fixed the issue for me. Cheers
Using ubuntu 16.04, letsencrypt, nginx, apache2, wordpress. For me
1. adding redirect in `/etc/apache2/sites-enabled/000-default.conf` didn't work (too many redirects)
2. adding RewriteRule in .htaccess didn't work (too many redirects)
Finally I installed really-simple-ssl plugin from wordpress and it worked like charm.

HTTPS on dev server - issues

I copied a live woocommerce site back to the dev server. The live site uses https. So when I tried accessing it on the dev server, it redirected me to the live site. I figured the issue was the .htaccess file. I tried editing it, but the file is encrypted. So I just removed it all together. That stopped the redirecting, and I was able to access the front-end of the dev site. However when I try to access the wp-admin or wp-login.php I get a 404. I also noticed that the broswer changed from http to https. So there's something still trying to make the website run under https.
What I've tried:
I deactivated woocommerce plugin (by renaming it) but that didn't
help.
I also searched in the database for instances of https:// but I
could not find any that related to the website.
I also found and removed a cert.html file in the root which I think
it's related to the https certification, but I still can't access
the backend.
And last, I tried to add a new .htaccess file with the basic
wordpress permalinks in it, but that just gave 500 server errors.
Can anyone give some pointers where to look? Or what could be causing the browser to use https, instead of http.
It looks like you need to change your site URL to point to the right place. Since you can't log in (it'll redirect you to the wrong site URL), you need to change this in your wp-config.php file (see this link for more info):
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
After that, and hopefully with the default wordpress rules, you should be able to log in to the admin pages.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The above assumes that your wordpress site is at /.

Redirect/Security Issue With Website Link

I'm running into a rather annoying problem with my website.
I have a valid SSL certificate running on my domain but every time I try to manually access a certain page from my website it appears as non-ssl.
If I browse the pages starting from my homepage they all appear to be fine but if I go directly to a page the browser tells me that is not secured.
The odd thing is that this only happens when I type the link without "https/https" and www. Ex: "mywebsite.com/my-page".
If I'm entering "www" before the domain name or http/https it redirects to the secure version.
As a side note, I'm using WordPress as my CMS.
I would highly appreciate the help.
Thank you.
You can force https by adding the following to your htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Resources