[英]Redirect a subdomain to a new URL
我有一個客戶,該客戶在Joomla中有一個主要站點,在WordPress中有一個博客。 我們只是將所有內容都制作成了一個WordPress網站。
我需要幫助的是將子域(例如blog.example.org)重定向到新的URL(example.org/blog)。
我相信這需要使用.htaccess
來完成,並且也需要與WordPress集成。
這是我到目前為止所到之處:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^example.health-access.org
RewriteRule ^(.*)$ http://example.org/blog/$1 [L,NC,QSA]
</IfModule>
# END WordPress
但這不起作用。 任何想法和幫助,我們將不勝感激。
您只需要更改順序:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.health-access.org [NC]
RewriteRule ^(.*)$ http://example.org/blog/$1 [R=301,L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#END WordPress
嘗試這個:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursubdomain\.yourdomain\.com$ [
RewriteRule ^(.*) http://www.newdomain.com/?param=data&uparam2=data
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.