Answer the question
In order to leave comments, you need to log in
How to change the site access root in .htaccess?
Help! We need to change the way the site works.
Yii engine. .htaccess file content
AddDefaultCharset utf-8
# Universal redirect from C domain www. to a domain WITHOUT www
# if necessary - uncomment:
#
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^(.*)$ http:// %1/$1 [R=301,L]
# prevent httpd from serving dotfiles (.htaccess, .svn, .git, etc.)
RedirectMatch 403 /\..*$
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
When you enter the site address, a list of files and folders on the hosting appears. The site itself is located in the /public/index.php folder.
How can I make sure that when entering the site url, the start (main) page opens and not the list of folders and files?
Help me please!
Answer the question
In order to leave comments, you need to log in
Try this
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} ^www/.(.+)$ [NC]
# RewriteRule ^(.*)$ http://%1/$1 [R=301, L]
# prevent httpd from serving dotfiles (.htaccess, .svn, .git, etc.)
RedirectMatch 403 /\..*$
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule *. index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question