I am having an issue trying to change my rewrite rule to use https.
Before change, I had the following:
RewriteEngine On
RewriteBase /
RewriteRule ^api/(.*)$ http://example.com/api/$1 [L,P]
Which redirected all the requests with 'api' to my server.
Now, I've changed http to https:
RewriteEngine On
RewriteBase /
RewriteRule ^api/(.*)$ https://example.com/api/$1 [L,P]
And when I am testing this, it throws:
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
What am I doing wrong here?
My .htaccess
is:
Options -Indexes +FollowSymLinks -MultiViews
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 648000 seconds"
ExpiresByType application/javascript "access plus 648000 seconds"
ExpiresByType application/x-javascript "access plus 648000 seconds"
ExpiresByType text/html "access plus 6000 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
# END Expire headers
RewriteEngine On
RewriteBase /
RewriteRule ^api/(.*)$ https://example.com/api/$1 [L,P]
# external redirect from /example.html to /example
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^.]+)\.html [NC]
RewriteRule ^ /%1/ [R=301,L]
# internal forward from /example/ to //example.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+?)/?$ /$1.html [L]