Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从url中删除index.html_Html_.htaccess_Redirect - Fatal编程技术网

如何从url中删除index.html

如何从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

我已将我的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/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文件的目录中