[英]apache redirect /url1/* to /url1/index.html
I changed the context url from: domain.name/url1
to domain.name/url2
我将上下文 url 从: domain.name/url1
更改为domain.name/url2
I want to have a 301 redirect of all URLs from我想对来自的所有 URL 进行 301 重定向
domain.name/url1/*
to the static file domain.name/url2/moved.html
and show a static maintenance page domain.name/url1/*
到 static 文件domain.name/url2/moved.html
并显示 static维护页面
The rewrite rules should not take into account any other URLs except domain.name/url1/*
for this redirect重写规则不应将此重定向考虑除domain.name/url1/*
之外的任何其他 URL
url1
and url2
are subfolders in the apache directory /var/www/home/
url1
和url2
是 apache 目录/var/www/home/
中的子文件夹
The apache configuration is: apache 配置为:
Listen 9082
<VirtualHost *:9082>
ServerName domain.name
DocumentRoot "/var/www/home"
<Directory />
Require all denied
</Directory>
<Directory "/var/www/home">
Require all granted
RewriteEngine on
AllowOverride all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
</VirtualHost>
You may try this code in your url1/.htaccess
:您可以在url1/.htaccess
中尝试此代码:
DirectoryIndex index.html
RewriteEngine On
RewriteRule ^index\.html$ - [NC,L]
RewriteRule . /url1/ [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.