CSS, JS and Images Links missing when using HTTPS - php

I have a serious problem with the links when using https. My knowledge with using https is poor. Although following are the processes that i've done so far.
Scenario:
I have a site that uses HTTPS. ( Certified )
I need only one CheckOut page to load in https where the checkout page is related to sub-domain. ex. member.mydomain.com
Site is in WordPress
Not using WooCommerce !!
Results:
Using htaccess i managed to redirect that certain page ie. Checkout page in https and it works.
ex. https://member.mydomain.com/checkout
However, The Problem:
The problem is that all links are dead links in the checkout page due to which it messes up the whole site. The CSS, JS files all are being loaded in https.
What i have tried so far !!
I tried updating the general settings url to https. So, it works but the same issue to all pages. All the links are broken.
Followed the instructions on this post https://wordpress.stackexchange.com/questions/75921/ssl-breaks-wordpress-css
Also, in this https://managewp.com/wordpress-ssl-settings-and-how-to-resolve-mixed-content-warnings
But the above did not seem to do the trick. I still have the broken links. What am i missing here? Please suggest.
Thank you

Found the solution finally.. Tried modifying the htaccess file again.
Following is what i added in my htaccess in order to fix the problem. It might be useful to someone in the future.
<IfModule mod_rewrite.c>
#-------------------SUB.DOMAIN.COM---------------------
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteCond %{DOCUMENT_ROOT}/members%{REQUEST_URI} -f
RewriteRule . %{DOCUMENT_ROOT}/members%{REQUEST_URI} [L]
RewriteCond %{HTTP_HOST} ^ subdomain.domain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . subdirectory/index.php [L]
#-----------------SUB.DOMAIN.COM---------------------
</IfModule>
# 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
This solved the subdomain issue and the 500 error requests as well as the broken links problem.

Related

Wordpress has a nasty redirect not allowing ssl

I am encountering a problem with my wordpress page. I am using the sporty theme and have setup the page. Now I would like to activate SSL.
What have I done:
I changed
siteurl and home in the wp-options table
I used the DB Migrate plugin to modify all links.
I set up my htaccess file like this
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I am still stuck with a redirect to the base url which start with http. Even if I remove the htaccess this happens, so i doubt the htaccess is the problem.
I also tried adding
define('WP_HOME','https://tc-eislingen.de');
define('WP_SITEURL','https://tc-eislingen.de');
to the wp-config.php but the nasty redirect to http stays.
Is there a redirect in the template I am missing?
Update
Why the downvote? I followed all the rules? Is there anything wrong why my quesiton?
you shouldn't be changing .htaccess file code for it. Just change the urls in database and install
Really Simple SSL
and activate necessary settings in it. You must change http: url you placed manually into https though.

SSL only working on half of site

I have an SSL through Cloudflare and it only works on my main site, and not the wordpress part.
regular site:
http://championsdrivingschools.com
wordpress
http://championsdrivingschools.com/checkout/
If I do force SSL on the site it makes the wordpress look all it style and everything and it looks just like text
If you have added static URL in the pages without https then Url will not show green sign in the browser. please check static URL of any static assets and set below setting to make all pages with https.
Step 1: In your WordPress administrator dashboard, go to Settings -> General and change both URLs to have https:// rather than http://.
Step 2: These site asset files can easily be corrected by fixing the rewrite rules in your .htaccess file found at the root of your WordPress application.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
To get started, head to WooCommerce > Settings.

Wordpress login in error wp-admin err_too_many_redirects

I am having a problem with wordpress login. I am using wordpress 3.9 and suddenly I am unable to login to my admin or any account. When I type https://lifesymb.com/wp-admin/ then I am getting the following error.
This webpage has a redirect loop
The webpage at https://example.com/wp-admin/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Learn more about this problem.
Error code: ERR_TOO_MANY_REDIRECTS
I tried by clearing my cookies, tried in another computer and tried changing the .htaaccess as below
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And tried many ways but I am unscuccessful but my site is displaying good and my site uses SSL. so could any one help me in solving this issuse.
Thank you

Htaccess proxy redirect wordpress error

I want to redirect domainA.com/folder/ which originates within an older wordpress installtion to domainB.com/folder1/folder2/ which is the link to the page within my new wordpress installation wihtout the url changing.
I have managed to achieve this with the .htaccess file inside domainA.com/folder/ which reads:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/folder
RewriteRule ^(.*)$ http://www.domainB.com/folder1/folder2/ [P]
The Rewriterule [P] (proxy) flag does what I want and redirects the page without changing the url but some of the content within my Enfold WP template such as the advanced layer slider and icons fail to load.
I assume this error is due to some sort of conflict with WP's native htaccess code and I also suspect it has to do with the lines:
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
I have experimented with adding the first, third and fourth lines to my code but it doesnt work. Does anybody know how I could resolve this issue?
If it makes any difference the wordpress site I want to direct to (domainB.com/folder1/folder2/) is one whithin a Wordpress Network.
For the moment I have changed the [P] flag to [L] flag which redirects and works but changes the url.
Any help or advice would be much appreciated. Thank you!
Try to change the paths of images (the URLs) in advanced layer slider and icons URLs from
relative to absolute ones (as described in RFC 2396), then you can use the [P] flag in .htaccess again.
Often plugins uses relative paths when outputting content, but this can cause such type of troubles.
This following code takes care of permalinks in WorPress and it is recommended to keep the beginning and ending WordPress lines so that WordPress is able to locate it and modify it as needed. You may already have all this and are just not displaying it. I do not know.
# 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
In the other section you probably need to remove the trailing / after folder2 like so:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/folder
RewriteRule ^(.*)$ http://www.domainB.com/folder1/folder2 [P]

.htaccess acting funky after moving site from Drupal to standalone

I recently tore down my full Drupal site and rebuilt the whole thing in my own framework from scratch. The site is great. But, the problem is when you type a search in google for images. When you click on an image for my site, instead of landing on the right page, it redirects to the home page. Every URL is exactly the same / same content. The only differece in the .htaccess is:
My site:
Options +FollowSymLinks
RewriteEngine On
# GoDaddy Requires -MultiViews
Options -Multiviews
RewriteBase /
RewriteRule ^([a-zA-Z0-9-]+/?)$ $1.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-]+) index.php?page=$1 [NC]
Old Drupal Site:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
It's really frustrating. Right now it's about 700 unique visitors a day and 500 of those land on the home page when about 80% percent of them were supposed to land on a different page from a google searched image. Any ideas why this is happening?
-- I don't think the reason is because it was directing to /node/59(Nodes instead of specified paths). I had clean urls enabled and it's redirecting to the home page for every searched image which is a lot.
Your .htaccess looks fine, I don't think that it has anything to do with it.
What you're looking for is some sort of script in that site that is checking for an "valid" referrer, or I'm suspecting that your loading some Javascript to to the following thing:
if (top.location != location) {
top.location.href = document.location.href ;
}
Remove it. It's frame busting code, and has been an (awful) practice for many years in webdevelopment, but it doesn't serve any purpose.
You might try uncommenting and changing the following line in your sites/default/settings.php file.
# $base_url = 'http://www.example.com'; // NO trailing slash!
This has solved problems that I've had when moving a site from my local development site to a remote production site.
Good Luck!

Categories