【发布时间】:2023-03-04 00:40:02
【问题描述】:
我正在寻找一种方法,以便用户可以通过键入 xxx.example.com 访问他们的页面,然后转发到他们各自的 WordPress 帖子。
现在我的网站上已经有了两个重写功能:(不是我写的)
到处使用 https:
#Rewrite everything to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
还有 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]
</IfModule>
# END WordPress
现在,WordPress 功能似乎将example.com/post_title 翻译成相应的帖子。
但是我该如何重写它以便将post_title.example.com 转换为相应的帖子?
如果可能,仍然显示xxx.example.com 而不是example.com/xxx
【问题讨论】:
-
没人知道,还是不可能?
-
好吧。 Domain.com 将打开根目录,xxx.domain.com 将访问 domain.com 中的目录 xxx。还是我搞错了?
标签: apache .htaccess mod-rewrite url-rewriting