I made a website that I run locally. I configured a my host file and virtual host:
Adress: website.dev
DocumentRoot: /www/website/public_html
I can access the website correctly.
In the public_html folder are the following files:
index.php
.htaccess
I tried to configure an .htaccess file, but I am not very experienced with that so maybe I did something wrong.
The idea is that every request like 'website.dev/users' or 'website.dev/login' is processed by the index file so I can handle the given URL. (I think that the URL: website.dev doesn't need a rewrite, because it directly leads to the index.php because it is the documentRoot)
This works fine but I noticed, when I use a rewriteRule
in the .htacces file that my pages got opened called multiple times.
This is my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
When I comment out all the rewriteRule
lines, and go to: website.dev, I see that my pages only got called once. What in the .htaccess file can cause the double page calls?
Address
really misspelled in your virtual host file? You haveAdress
instead ofAddress
. You also hadhtacces
instead ofhtaccess
several places.