如何在同一域中使用vue构建文件和wordpress运行网站

问题描述

我在vue中有一个托管域www.xxx.com的网站(在pm2中运行)。我需要在wordpress中运行我的博客页面。 (www.xxx.com/blog)。
www.xxx.com/blog需要在wordpress页面和域www.xxx.com的所有其他URL中重定向到vue项目。有什么选择吗?

解决方法

我建议使用.htaccess(或其他服务器的等效名称),然后简单地重定向此特定网址。

可能看起来像这样:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# Wordpress
RewriteRule ^blog$ /path/to/wordpress/index.php [L]

# Vue
RewriteRule . /index.html [L]