简体   繁体   中英

Hosting a wordpress blog in a Laravel application

I currently have a Laravel application deployed in a autoscaling group at www.example.com and a wordpress blog at blog.example.com on a single instance.

I have been asked to move the blog to example.com/blog .

I don't want to merge the code bases and the blog does not need to be in the autoscaling group.

I tried to use rewrite rules to rewrite example.com/xxx to blog.example.com without affecting the url in the browser but I can only get it to redirect ending up with blog.example.com/xxx in the address bar.

What is the best way to achieve having example.com/blog/xxx as a valid url while allowing me to host the Wordpress installation far far far away from my Laravel app?

This was my attempt at url rewriting which didn't work

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC]
RewriteRule ^/blog(.*)?$ http://www.example.com/$1 [L,R]

Many thanks

Try to use this before Laravel rules:

RewriteRule ^blog - [L,NC]

This will let you use Wordpress with Laravel.

Also, you could try this solution .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM