我有一个subdomian设置,我想指向一个特定的目录。
cdn.domain.com我希望cdn.domain.com指向domain.com/wp-content/,但不是作为重定向,因为这只会显示cdn.domain.com/wp-content/。
我想设置域根目录,这样当我编写cdn.domain.com时,它将显示位于domain.com/wp-content/的文件。
有谁知道我该怎么做吗?
发布于 2013-11-15 19:21:09
我设法用.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]https://stackoverflow.com/questions/19999237
复制相似问题