简体   繁体   中英

wildcard ssl .htaccess file causes 500 error on laravel subdomain

I have a wildcard ssl installed on my account (My host is Bluehost) and I followed the directions here from Bluehost's site to install the wildcard SSL. However, when I try and access the site at all it comes up with a 500 internal server error. I am using laravel framework right now for the subdomain, I don't know if that changes anything, but here is the .htaccess file for the main site (Which is a wordpress site):

# Custom subdomain .htaccess SSL + WordPress
        RewriteCond %{HTTP_HOST} ^admin.mysite.com$
        RewriteCond %{REQUEST_URI} !^/admin/public/
        RewriteRule ^(.*)$ /admin/public/$1
        RewriteCond %{HTTP_HOST} ^admin.mysite.com$
        RewriteRule ^(/)?$ admin/public/index.php [L]
        # End custom subdomain .htaccess


# BEGIN WordPress
AddHandler application/x-httpd-php70s .php
<IfModule mod_rewrite.c>
# Custom maindomain .htaccess WordPress
        RewriteBase /
        RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        # End custom maindomain .htaccess
</IfModule>

# END WordPress

And here is the .htaccess file for the subdomain (the one with laravel installed):

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Keep in mind too, I know nothing about .htaccess or how it works, I just did what the webpage said to do.

I suggest you to try below code for simple redirection HTTP to HTTPS:

RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This should work for your main domain and its sub-domain both. Now if you want to redirect Non-WWW domain to WWW then try below code;

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.domainname.com%{REQUEST_URI} [L,R=301]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM