SSL is breaking my htaccess file in WordPress

141 views Asked by At

My .htacess file is vital not only for redirection but for the look of the site. I'm not sure why the developers of this theme did this but I can't change that.

If you navigate to http://akcrossfit.com you'll see the site as it should be. When you navigate to https://akcrossfit.com you'll see the site without styling and any navigation leads to a 404 error.

Here is my .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^other/(.*) /wp-includes/$1 [QSA,L]
RewriteRule ^file/(.*) /wp-content/uploads/$1 [QSA,L]
RewriteRule ^ext/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteRule ^skin/main\.css //index.php?style_wrapper=1 [QSA,L]
RewriteRule ^skin/(.*) /wp-content/themes/richer-child/$1 [QSA,L]
RewriteRule ^richer/(.*) /wp-content/themes/richer/$1 [QSA,L]
RewriteRule ^skin_main/(.*) /wp-content/themes/richer/$1 [QSA,L]
RewriteRule ^ajax /wp-admin/admin-ajax.php [QSA,L]
RewriteRule ^wp-content/themes/richer-child/screenshot\.png|readme \.html|license\.txt|wp-content/debug\.log|wp-includes/$ /nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Any idea what to change to fix this issue? The site is being hosted on Google Cloud Compute Engine. Thanks in advance for the help

Here's my VHost config (at least the part that's relevant to this topic)
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName akcrossfit.com:443 DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>

1

There are 1 answers

7
drew010 On BEST ANSWER

When I try to go to the site over https it redirects me to the non-https URL but I suspect the problem is with the WordPress address and site URL in Settings >> General.

When you view the site, the references to your CSS and Javascript files are going to be linked over http which will prevent some browsers from loading the insecure content.

If you want the site to be secure, change your WordPress address to the https URL so the resources and links use SSL.

EDIT: After being able to see the site over https, it looks like all of your resources (js, images, javascript) are coming back as 404 errors. It even looks like the .htaccess rewrite rules aren't working for posts and pages. This is most likely due to an error with the VHost configuration for the SSL site. Apache error logs may help but I'd look at the SSL vhost first to see how it differs from the main site.

EDIT 2: The problem is now that in your <Directory /var/www/> section there is AllowOverride None which effectively disables the .htaccess rewrite rules from being applied.