[英]PHP .htaccess redirect root to specific folder
I have website example: http://example.com
我有一个网站示例: http://example.com
: http://example.com
and on my local project I name the folder is project1
. 在我的本地项目中,我将文件夹命名为project1
。 http://localhost/project1 http:// localhost / project1
Now when I copy the folder to public_html, I want .htaccess
target it to the folder project1
现在,当我将文件夹复制到public_html时,我希望.htaccess
将其定位到文件夹project1
So, when I open http://example.com/
this will redirect to folder project1
因此,当我打开http://example.com/
它将重定向到文件夹project1
How to do this on .htaccess? 如何在.htaccess上执行此操作?
Try this 尝试这个
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /project1/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /project1/?index.php
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.