getting 404 error when attempting to redirect to https

Member | 41

is there an alternative .htaccess file for www root?

on domain A (not Nette) with SSL turned on and mod_rewrite
can access homepage and click on link and have that rewritten
to https successfully.

the conf file in apache is:

<IfModule mod_rewrite.c>

       RewriteEngine on
       	#redirects all traffic to https
       RewriteCond %{HTTPS} off
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  ###  RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]


if i use the code above, or Nette's standard code in the htaccess file:
on DOMAIN B which uses nette framework…

#nette .htaccess
	RewriteEngine On
RewriteBase /

	# use HTTPS
RewriteCond %{HTTPS} !on
 RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

the Nette code works fine on redirecting the home page to HTTPS, but when clicking on a link on the homepage server throws 404 error (page not found), nothing is in server error or access logs, turning on Tracy works fine on homepage, but disappears on clicking the link. Since i have tried server with and without mpm, with and without mod_php, and everything works
fine on non nette framework site then, maybe i have a typo somewhere in latte file or old htaccess file???

thanks in advance for any thoughts,

Last edited by jdan1131x (2021-05-22 20:18)

Member | 41


strangely, non nette sites work ok without this fix. but ssl with nette was
not working until i added this code to the ssl.conf file for the site

<Directory “/var/www/html/production/mywebsite-1.1.20/www”>

AllowOverride All
Require all granted


its very basic apache statements. very simple. now i can
go walk the dog :-)