簡體   English   中英

apache 重定向 /url1/* 到 /url1/index.html

[英]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

url1url2是 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM