如何从url中删除index.html
我已将我的HTML文件上载到我的网站。现在,我需要找到一种方法,当用户进入www.mywebsite.com时,将其重定向到Home.html页面 我曾尝试在htaccess中对此进行修改,但没有成功,我不确定是否正确如何从url中删除index.html,html,.htaccess,redirect,Html,.htaccess,Redirect,我已将我的HTML文件上载到我的网站。现在,我需要找到一种方法,当用户进入www.mywebsite.com时,将其重定向到Home.html页面 我曾尝试在htaccess中对此进行修改,但没有成功,我不确定是否正确 RewriteEngine On #if request is mywebsite.co.uk/something OR RewriteCond %{HTTP_HOST} ^mywebsite\.co.uk$ [OR] # or www. mywebsite.co.uk/som
RewriteEngine On
#if request is mywebsite.co.uk/something OR
RewriteCond %{HTTP_HOST} ^mywebsite\.co.uk$ [OR]
# or www. mywebsite.co.uk/something
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.co.uk$
# but not mywebsite.co.uk/Home.html
RewriteCond %{REQUEST_URI} !^/Home.html/
#change it to mywebsite.co.uk/Home.html/something
RewriteRule (.*) /Home.html/$1 [R=301]
删除您的代码并仅将此@
.haccess
文件放入:
DirectoryIndex Home.html
确保.htaccess文件位于要更改index.html文件的目录中