Loading CSS and JS using HTTPS on Wordpress - wordpress

I'm trying to force HTTPS on a wordpress site, but my styles and scripts don't loading.
When I display page source code with Chrome I can see styles and scripts use HTTP to loading, I don't understand why.
I set HTTPS in wordpress general/settings for website URL and for wordpress URL. It's a fresh wordpress install with a default theme.
I tried to add this in wp-config.php
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
It works but when I want to login to https://www.mywebsite.com/wp-admin, wordpress display me this message:
"Sorry you are not allowed to access this page"
Any idea?

Have you done a replace on the database which replaces all old http urls to https? You use a seperate tool for this. Place the directory in the folder where you have your wp-config.php and it should connect automaticly to your database. Make a backup beforehand;
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

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.

Wordpress https:// broken home page and admin area

My wordpress website is using cloudfare and I desided to make my website from http:// -> https://
I installed Wordpress HTTPS and SSL Insecure Content Fixer plugins and changed URLs in Settings -> General (from http:// to https://)
This made my home page & admin area show "ERR_TOO_MANY_REDIRECTS". ALL other pages work great with the green https:// bar
I tried make things which I found on google: adding lines to wp-config.php or .htaccess But either it doesn't change anythin or it breaks other pages too.
Website is hosted on Ubuntu server.
P.S. Only if I replace https:// to http:// (through the mysql) I can access admin area and home page BUT they load without css styles.
Add this code to your wp-config.php (before $table_prefix = 'wp_'; line) and it will work.
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
define('FORCE_SSL_ADMIN', true);
The first block "tells" PHP that your website is already using https. (you need to tell it because it is not local apache https, but 3rd party out-server SSL). Second one forces wp-admin always use SSL.

Wordpress Visual Editor broken, it disappeared

I don't know how the visual editor broke, it has just disappeared.
users >> Profile >> Visual Editor check box - it's ok
I don't have permissions for editing wp-config.php, for add code define('CONCATENATE_SCRIPTS', false );
I removed all plugins
I have permission for editing files into /themes and admin panel.
Can you help me to fix this problem?
Inspect element shows:
Mixed Content: The page at 'example.com/blog/wp-admin/post-new.php'; was loaded over HTTPS, but requested an insecure stylesheet 'fonts.googleapis.com/css?family=Raleway:700,800,500,300,400‌​';. This request has been blocked; the content must be served over HTTPS
You're probably using wordpress with incorrect SSL configuration
Possible solutions are:
Make sure that the settings > site url & blog url both have SSL version
Install SSL Insecure content WordPress plugin and configure it properly
Install cloudflare WordPress plugin and configure it too if you're using cloudflare
Hire a professional (I can fix this too for your site if you're interested)

How to locate index.html / index.php in cPanel

I am editing a wordpress website. My client had a team working on editing it and they simply used the Wordpress editor to make changes. When I log in to cPanel, I see a 'coming soon' page in the index.html file. But the changes that the design team made cannot be located in any file. Also, when I access the website with a http, it shows the website (even when it's not supposed to be launched) and when I access the website with a https, it shows the welcome page. I don't know how two different pages are displayed by just changing the transfer protocol. How do I edit the theme?
If it is a WordPress website, the index file should be under this directory:
/website-root/wp-content/themes/ <- then the theme folder.
The theme, that's active on your website should be mentioned under Appearance > Themes. If you're not sure which one it is in /themes directory, look for the title here.
As you have cPanel, you should have an access to .HTACCESS file for your account. You can set index/default page for your website from .HTACCESS file. Please add the following code:
DirectoryIndex MyFileName.html // Replace MyFileName.html with your actual index file name.
HTTP and HTTPS should show the same contents. Please clear browser cache or verify your website from any alternate system or server.

Migrating wordpress

I am trying to migrate a Wordpress website from one hosting to another one. In the new hosting I can see it correctly if I access it from localhost, but if I try to render the web from an exteral pc, the .css and the images are not loaded (you can see it here 91.121.122.50/wp
Note that the link to the images points correctly (if you copy-paste the url of any image and open in a new window, it will load)
The new host has been configurated for a user, so I think it is a etc/hosts, apache2 or php configuration issue.
You can either update the database
//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' );
http://codex.wordpress.org/Moving_WordPress
or place the folowing in you wp-config
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
http://codex.wordpress.org/Changing_The_Site_URL
In order to make all links working you've to update your htaccess in your admin area under settings -> permalinks.
There is a WordPress plugin called duplicator. Using this plugin we can transfer WordPress website from one host to another. I think this is the simple and easy way to transfer WordPress sit. Here is the link.

Resources