首頁>Program>source

我正在尝試將Portal.example.com以外的所有子域从任何埠(通常是80或443)重定向到埠30000。

例如

  • example.com: (any port) shall have no change
  • www.example.com: (any port) shall have no change
  • portal.example.com (any port) shall have no change
  • a.example.com (any port) shall be updated to a.example.com:30000
  • b.example.com (any port) shall be updated to b.example.com:30000
  • *.example.com (any port) shall be updated to *.example.com:30000
  • etc.

我目前有關註 .htaccess ,直接指匯example.com和* .example.com:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
最新回復
  • 5月前
    1 #

    一些重構規則:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} !=30000
    RewriteCond !^((?:www|portal)\.)?example\.com [NC]
    RewriteRule ^ http://%{HTTP_HOST}:30000%{REQUEST_URI} [R=301,NE,L]
    

  • 5月前
    2 #

    請按照您顯示的示例編寫的內容尝試以下內容.在測試URL之前,請確保清除瀏覽器快取。

    RewriteEngine ON
    RewriteCond !^example\.com [NC]
    RewriteCond !^www\.example\.com [NC]
    RewriteCond !^portal\.example\.com [NC]
    RewriteCond (.*example\.com) [NC]
    RewriteCond %{SERVER_PORT} !^30000$
    RewriteRule ^(.*)$ http://%{HTTP_HOST}:30000%{REQUEST_URI} [R=301,NE,L]
    

  • Java txt檔案作為資料庫
  • Adding only the number of rows:仅添加行數-Java中的2D陣列