[英]apache redirect /url1/* to /url1/index.html
我將上下文 url 從: domain.name/url1
更改為domain.name/url2
我想對來自的所有 URL 進行 301 重定向
domain.name/url1/*
到 static 文件domain.name/url2/moved.html
並顯示 static維護頁面
重寫規則不應將此重定向考慮除domain.name/url1/*
之外的任何其他 URL
url1
和url2
是 apache 目錄/var/www/home/
中的子文件夾
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>
您可以在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.