Redirect/RewriteRule - Different Browsers
Hi, No issues with Edge, in Chrome the redirect is not working when redirecting a single subdirectory subDir
URI (without its files) to a single HTML page. Using LiteSpeed Cache with subDir
excluded, where the following (configured from cPanel) works well in Edge ( Firefox untested.) [QUOTE] RewriteCond %{HTTP_HOST} ^mySite.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.mySite\.com$ # RewriteRule ^subDir
\/?$ "https\:\/\/mySite\.com\/subDir
\/index\.html" [R=301,L]
There is a slight complication in the mix, being another WP installation in subdirectory subDir
which has the standard .htaccess code: [QUOTE] RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /subDir/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
Funny thing is, adding this rather suspect line at the end of the above subDir
.htaccess: [QUOTE] RedirectMatch 301 ^/subDir$ /subDir
/index.html
Although the page bugs out in Chrome, it's ignored by Edge altogether, and yes, do clear cache, load page in browser with CTRL-F5 etc. The index.html page gets a "not fully secure" warning in Chrome, don't really care about that -could we employ a RewriteCond %{HTTPS} on.off
approach? A case by case USER_AGENT approach might also work, albeit laborious and bug-prone. Thanks.
-
Ehm, the forum software has been updated with no notifications, and replies have been nuked, specifically from this thread including this response - can it be recovered?
https://forums.cpanel.net/threads/redirect-rewriterule-different-browsers.716033/#post-3018517
I don't know what is your situation, but I know that browsers don't process .htaccess, browsers send requests to the webserver and show what the webserver returns.
Indeed, the browsers certainly process the webserver messages, and if the webserver indicates to the browser that it has detected a change in the .htaccess file, then it would explain the outcome of the tests. The why's and wherefore's of that, or of the alternatives is open for comment.
0 -
Hopefully, the other post will return, meanwhile, couple of observations:
It's recommended to insert the generated cPanel redirect code at the top of the .htaccess file, else, as was in the use case, something either from WP or Litespeed clobbered it, even though excludes and defaults were used.
The redirect from the subdirectory works only when the trailing backslash is removed. The redirect with the trailing backslash has been also configured, no dice with redirection, easy to verify with whatsmydns. Both browsers agree on this, at least, the issue still remains partially unsolved, as attempts to use code from various sources to insert trailing slashes impacts adversely on the loading of the main site.
0
Please sign in to leave a comment.
Comments
2 comments