Internal server error when changing to https - .htaccess

My Yii site is giving an internal server error 500 after changing http to https in .htaccess when entering this line of code:
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
I have a valid SSL because my WordPress sites are working fine with https.
Also my site is a subdomain, but I don't think that would be the problem.
What can it be?

Errorlog: Request exceeded the limit of 10 internal redirects due to probable configuration error.
Fixed issue: Had to insert "rewritebase /" in the .htaccess file.

Related

Rewrite URL from HTTPS (Non-SSL Domain) to HTTPS (SSL Domain) Throws 404 Error

I have an IIS website (ISAPI Rewrite 3) with two domain aliases:
example.com (primary domain)
example.net
example.org
Example.com has an SSL cert. The others do not.
Consequently, I want to forward all HTTP and HTTPS traffic to HTTPS://EXAMPLE.COM. My .htaccess rules work fine except when requesting HTTPS://EXAMPLE.NET or HTTPS://EXAMPLE.ORG - it generates a 404 error. If I request HTTP://EXAMPLE.NET, HTTP://EXAMPLE.ORG, or HTTP://EXAMPLE.COM, .htaccess works fine - all requests are forwarded to HTTPS://EXAMPLE.COM.
Here's my super-simple .HTACCESS directive:
RewriteCond %{HTTP_HOST} ^example\.(com|net|org)$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L]
Any ideas why this is happening or how to fix it? Is the server intercepting secure requests for insecure domains and throwing a 404 before processing .htaccess?
Any assistance is appreciated.

403 Access is forbidden to the requested page errors on my website

I activate the SSL certificate and enable force redirection via c-panel to https but now my websites didn't open it says 403 Access is forbidden to the requested page errors on my website.
But when i disable force redirection then it works but only for http not for https.
HTTP works but HTTPS not working.
i also check permissions 644 for file and 755 for directories.
and here is the code in my .htaccess file
#Custom default index page
DirectoryIndex index.php
I also add these lines but didn't work
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
when i add these lines in .htaccess file the https urls shows something related to the server/domain hostpapa.
when i click on my website url it redirect me to https urls from http but it shows nothing just 403 forbidden error.

.htaccess causes Internal Server Error on xampp

I have .htaccess file and i write two command like that:
ReWriteRule ^member/(.*)$ /oz/photos.php?member=$1
ReWriteRule ^(.*)$ /oz/profile.php?username=$1
and this is the fault:
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at postmaster#localhost to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Apache/2.4.29 (Win32) OpenSSL/1.0.2n PHP/5.6.33 Server at localhost
Port 80
Your rule ReWriteRule ^(.*)$ /oz/profile.php?username=$1 is looping the request every time (recursion OR redirect Loop). The all selector in rule is redirecting the redirected request too.
try
ReWriteRule ^member/(.*)$ /oz/photos.php?member=$1
RewriteCond %{REQUEST_URI} !^/oz/.*
ReWriteRule ^(.*)$ /oz/profile.php?username=$1
Go inside your root folder and Delete/Move the.htaccess file from there and bruh! Solved! It's worked for me

Some users reporting site not secure

I have a client who just installed an SSL certificate. I added this to the .htaccess file to force users to redirect to https and force them to www:
# Redirect bare domain to www and HTTPS
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.twentyteninc.com/$1 [R=301,L]
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
I also addressed all the mixed content warnings. Now, everything redirects to https and I get the beautiful lock symbol in all browsers I test with.
Unfortunately, though, some users are still seeing the "Not Secure" messages:
If I run a Qualys SSL Test, it comes back with an A score:
What could be causing this? Why does everything look secure for me but not for some?
My problem was that the WordPress theme the client is using was pulling the favicon over HTTP instead of HTTPS and for whatever reason, my browser (and all the other browsers I tested with) was simply choosing not to load it at all.
This caused me never to get a mixed content warning.
After staring at the screenshot above for long enough, I noticed that the favicon was loading and that it wasn't for me which tipped me off to go digging through the theme for it.

How to use Drupal's htaccess to redirect from https to http

I have this Drupal project which inherited several domains, so I have:
www.domain1.com
www.domain1.co.uk
www.domain2.com
www.domain3.com
and I want to redirect all these domain to www.newdomain.com and also want to redirect all requests to https to http as well as redirect all the domains above without www to www.newdomain.com and have tried a few things but it didn't work.
Here's what I've tried:
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.newdomain.com/$1 [L,R,NE]
But with the above, all old domains (domain1.com, domain2.com, etc) gets redirected to www.newdomain.com, however when I hit https://domain1.com for example (it happens with all domains above using http), it shows a blank page. When I hit https://www.domain1.com it shows a warning from using a self signed certificate - meaning it doesn't redirect to http.
I've read on a page somewhere that I should delete these lines from htaccess:
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
But when I did, even the basic redirect that happens now (for instance, from www.domain1.com to www.newdomain.com stops working.
What am I missing here?
Thanks in advance
If https protocol always shows blank page, maybe there is distinct folder for it on your FTP ("httpsdocs" or something like that).
Also you should check your hosting provider's help page for more information about the https protocol and SSL certificate configurations.

Resources