Mobile app version of vmapp.org
Login or Join
Angela700

: Website redirects to httpss (not https) in Safari and IE but not Chrome I have made a redirect rule in my .htaccess file for https://pg-flowsolutions.com that specifies that if someone enters

@Angela700

Posted in: #301Redirect #Htaccess #Https #Redirects

I have made a redirect rule in my .htaccess file for pg-flowsolutions.com that specifies that if someone enters an invalid path (for instance pg-flowsolutions.com/blablabla) the visitor should be redirected to the websites index.

Now this works fine in Google Chrome, but in Safari and IE I'm experiencing that an extra 's' is appended to the address bar, so the browser is attempting to open httpsS://pg-flowsolutions.com - which obviously creates an error.

So the error I am looking for help to solve is where the extra 's' that is included in the address bar when opening a invalid URL actually comes from.

Is it something in my .htaccess file that causes this, can the extra 's' be caused by some server settings in Apache, or is it perhaps something that can be corrected in Wordpress even?

I have not been able to identify what causes this behaviour, my .htaccess file is the suspected culprit but I have not been able to find any errors there.

It currently forces all HTTP visitors of the site to the HTTPS version, and also it is supposed to redirect all attempts to open an non-existing page to the index site.

As mentioned, this works for me in Chrome but not other browsers.

My .htaccess file looks like this

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule .* %{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

You should seriously consider NOT redirecting soft 404's to the homepage! not only does it dampen the users experience provided, Google and Bing are unlikely to take a liking to it either But if you insist...

Delete the contents of your .htaccess file and import the following:

# BEGIN Removing WWW and Enforcing SSL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ %1%{REQUEST_URI} [R=301,L]
</IfModule>
# END Removing WWW and Enforcing SSL

# 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


Edit your WordPress 404.php

Then in your WordPress theme files (found in appearance) find 404.php and rename it 404-old.php, if there isn't one don't worry. In the theme folder create a 404.php and import the following:

<?php
header("HTTP/1.1 301 Moved Permanently");
header('Location: pg-flowsolutions.com/'); exit();
?>


I don't want to edit my 404.php

While I recommend editing 404.php you may prefer not too, if not you could simply the following code at the bottom of your htaccess file:


ErrorDocument 404 /index.php


WordPress Site Address


SOURCE

Ensure that you update WordPress to work as HTTPS, this can be done by login into the WordPress Dashboard and going to Settings > General. Then update these URLS:

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme