Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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
Html 是否可以使用htacess文件显示不存在的url_Html_.htaccess_Url Redirection - Fatal编程技术网

Html 是否可以使用htacess文件显示不存在的url

Html 是否可以使用htacess文件显示不存在的url,html,.htaccess,url-redirection,Html,.htaccess,Url Redirection,不确定这是否可行。我在子目录中有一个.html文件。我想找到一种方法来设置它,在访问该文件/目录时,使用HTACCESS(我想象中)显示一个备用URL 因此,如果入站URL类似于我如何使用HTACCESS强制浏览器显示 可能吗?还是我只是一个疯狂的空想家 谢谢 是的。你可以 RewriteEngine on RewriteRule ^target-directory/file.html$ http://renamedURL.com/ [L] 您可以使用: RewriteEngine on R

不确定这是否可行。我在子目录中有一个.html文件。我想找到一种方法来设置它,在访问该文件/目录时,使用HTACCESS(我想象中)显示一个备用URL

因此,如果入站URL类似于我如何使用HTACCESS强制浏览器显示

可能吗?还是我只是一个疯狂的空想家

谢谢

是的。你可以

RewriteEngine on
RewriteRule ^target-directory/file.html$ http://renamedURL.com/ [L]
您可以使用:

RewriteEngine on

RewriteCond %{THE_REQUEST} \s/+target-directory/file\.html[?\s] [NC]
RewriteRule ^ http://renamedURL.com/ [R=302,L,NE]

RewriteRule ^/?$ /target-directory/file.html [L]