簡體   English   中英

重定向子域而不更改htaccess中的url

[英]Redirect subdomain without changing url in htaccess

我的.htaccess

RewriteCond %{REQUEST_URI} ^/(poodle|mandy|sandy|nova|wendy) [NC]
RewriteRule ^.*$ /wendy/index.php#%1 [L]

在這里,我能夠重定向所有文件夾而無需更改url。

但是當我嘗試去重定向子域時

喜歡

wendy.xxxxxx.com/ggsgs/sfghdsgd.html

我收到內部服務器錯誤。

我可以通過任何方式將所有子域重定向到wendy / index.php而無需更改url。

謝謝。

您不應該在.htaccess中管理域重定向。 應該使用VirtualHosts在apache config中配置它,如下所示:

<VirtualHost *:80>

  Servername name1 
  ServerAlias name2
  ServerAlias name3

  [...]

</Virtualhost>

如果要重定向ANY子域,則可以使用通配符:

ServerAlias *.example.com

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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