将子域重定向到Post URL

时间:2018-04-25 18:49:00

标签: url-rewriting apache2 subdomain

当有人在我的网站上访问该帖子名称的子域名时,我想重定向到我的帖子网址。

喜欢这个

  

https://www.example.com/sub/mypost ---------> https://mypost.example.com

该网站正在Apache服务器上运行

因此尝试对.htaccess文件进行一些更改

请不要一切都是SSL

RewriteEngine on RewriteCond%{HTTP_HOST} https://$1.example.com [NC] RewriteRule ^(。*)$“https://www.example.com/sub/ $ 1”[L,P]

它似乎没有用。它重定向到Site无法在浏览器上显示消息。

这是我在改变前的普遍htaccess文件。

# 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

谢谢。

0 个答案:

没有答案
相关问题