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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.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
.htaccess 重定向特定页面,然后重定向所有其他页面_.htaccess - Fatal编程技术网

.htaccess 重定向特定页面,然后重定向所有其他页面

.htaccess 重定向特定页面,然后重定向所有其他页面,.htaccess,.htaccess,从哪里开始 我需要移动一个网站到一个新的子域与约20个特定的网页,然后只是空白重定向一切 有什么想法吗?您希望在.htaccess文件中有类似的内容: Options +FollowSymlinks -MultiViews RewriteEngine on # Redirect specific pages RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC] RewriteRule ^(index\.html)$ http://newdomain.co

从哪里开始

我需要移动一个网站到一个新的子域与约20个特定的网页,然后只是空白重定向一切


有什么想法吗?

您希望在
.htaccess
文件中有类似的内容:

Options +FollowSymlinks -MultiViews
RewriteEngine on

# Redirect specific pages
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC]
RewriteRule ^(index\.html)$ http://newdomain.com/path/$1 [R=301,L,NC]
RewriteRule ^(index2\.html)$ http://newdomain.com/path/$1 [R=301,L,NC]
RewriteRule ^(index3\.html)$ http://newdomain.com/path/$1 [R=301,L,NC]

# Redirect all others to the new domain
RewriteRule ^(.*)$ http://newdomain.com/ [R=301,L]
使用以下工具针对您的情况进行定制和测试: