将根重定向到另一个文件夹,但其他任何内容都可以应用程序路由器



不确定我想要做什么,我在这里发现了很多东西,但没有完全。我想/需要/需要将root URL(/)重定向到Web根部在其自己的子文件夹中运行的WordPress站点。使用:

RewriteEngine on
# our root gets redirected to wordpress
RedirectMatch ^/$ http://mysubdomain.com

...很好。然后,除了root(例如example.com/somepath)以外,我需要在根中index.html来处理它。这是带有自己的路由器的VUE JS应用程序的切入点。我尝试了:

RewriteEngine on
# our root gets redirected to wordpress
RedirectMatch ^/$ http://mysubdomain.com
# anything else load our app (index.html in the web root)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://example.com/$1 [L,QSA]

...但这会导致过多的重定向鲍尔斯(Bowser)中的错误。我尝试了:

RewriteEngine on
# our root gets redirected to wordpress
RedirectMatch ^/$ http://mysubdomain.com
# anything else load our app (index.html in the web root)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.html [L,QSA]

...而且几乎有效的是,这些路径中有一个字面的索引。html,而不仅仅是URL路径。目的是要通过Web根中的HTE VUE JS应用程序拥有其他任何其他路径(通过index.html)到达字面的路径。因此,如果转到http://example.com/somepath,则浏览器位置应该是通过VUE JS路由器的路径过程。

希望这是有道理的。有什么想法或想法吗?我也知道我可以将其重定向到其中带有VUE JS应用程序的子文件夹,但这不是客户想要的,除非可以将该子文件夹从URL中排除。

tia!

我们选择使用VUE JS应用程序路由器重定向,以便root URL(/)进行JS重定向,以尝试通过.htaccess重定向。问题已解决。

相关内容

最新更新