![](/img/trans.png)
[英]How can I use mod rewrite to point to a subdirectory given a subdomain?
[英]How do I rewrite a subdomain to use a prettier format in a wordpress environment?
subdomain.example.com/page 到 example.com/subdomain/page?
我嘗試在我的 cPanel 中重定向並在 wp_options 中更改站點 URL。 仍然沒有運氣。
提前致謝。
為此,請使用以下 htaccess 代碼。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [NC]
RewriteRule ^(.*)$ "http://example.com/$1" [R=301,L]
</IfModule>
嘗試
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$ [NC]
RewriteRule ^(.*)$ "http://example.com/%1/$1" [QSA,L]
</IfModule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.