[英]How to map subdomain root to domain folder
我有一个subdomian设置,我想指向一个特定的目录。
cdn.domain.com
我希望cdn.domain.com
指向domain.com/wp-content/
,而不是重定向,因为这只会显示cdn.domain.com/wp-content/
。
我想设置域根目录,以便在编写cdn.domain.com
将显示位于domain.com/wp-content/
的文件。
有谁知道我该怎么做吗?
我设法通过.htaccess文件中的以下代码完成了我想完成的工作。 :)
# Rewrite all requests for wp-content from cdn, so they are fetched from the right place
RewriteCond %{HTTP_HOST} ^cdn\.responseretail\.no
# Prevent an endless loop frm ever happening
RewriteCond %{REQUEST_URI} !^/wp-content
RewriteRule (.+) /wp-content/$1 [L]
# Redirect http://cdn.domian.com/ to the main page (in case a user tries it)
RewriteCond %{HTTP_HOST} ^cdn\.domain\.com
RewriteRule ^$ http://www.domain.com/ [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.