Search the Community
Showing results for tags 'htaccess'.
-
I know this is a pretty basic thing, but I've seen so many tutorials out there that are non-dynamic solutions. Normally when you google "How to force HTTPS using an .htaccess file" or "Redirect HTTP to HTTPS using an .htaccess file" you get examples like the below. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] This does work, but you have to replace www.example.com with your domain and it's then hard-coded and not dynamic. I don't like hard-coding anything unless it's absolutely necessary, so here's an example of the dynamic way to redirect to https from http requests using your htaccess file. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] View the Prodjex Blog post on How To Force HTTPS Using .Htaccess.
-
In Laravel the path for serving your web page is in the /public folder. By default after installing Laravel and navigating in a browser to the URL you will see a directory listing of all the Laravel files. Here’s an easy way using an .htaccess file to redirect requests to the Laravel /public folder user mod_rewrite. Create a .htaccess file in your root directory and add the following code. RewriteEngine on RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L] Save your file and refresh your browser, you should now see the default Laravel splash page.
Our Network
About Us
Prodjex is a Kansas City web development company that provides end-to-end web development services for all things web related. Founded in 2017, we’ve grown quickly and provide web consulting services to clients not only in Kansas City, but across the US.