Home Redirect with MVC and HTTPS
Reply: 0

Redirect with MVC and HTTPS

user1134 Published in June 19, 2018, 6:23 pm

I have created a website following the MVC-structure from the CodeCourse-youtube series https://www.youtube.com/watch?v=OsCTzGASImQ.

The folder is structure:

Now there are three .htaccess-files. One in the "bestil"-folder, one in the "app"-folder and one in the "public"-folder.

"Bestil"-folder .htaccess:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]

RedirectMatch ^/$ /public/

"public"-folder .htaccess:

Options -MultiViews
RewriteEngine On

RewriteBase /public

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

The .htacess-file in the app folder just block unattempted access. As you can see I tried to mix my MVC-rewrite conditions with the https-which does not work, as all the content I loaded are "mixed", hence .css-files and .js-files are loaded over http.

I am not an expert on .htaccess-writing, therefore I am asking you how to make both .htacess-files proper?


You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.509851 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO