简体   繁体   中英

Serve /blog from a different url in .htaccess file

My website also has a blog and the blog is hosted on a different server.

How can I serve the blog from that server using .htaccess?

So for example www.example.com/blog/ should serve files from www.othersite.com/ without changing the url.

Tried something like this, but i'm getting 404:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://www.othersite.com/  [L]

Thanks!

I'm pretty certain that this can't be done. If this could be done then what would there be to stop me hosting http://mywebsite.com/my-awesome-article and simply ripping someone else off by using their content as part of my site?

Maybe you can try this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/blog(.*)$ http://www.othersite.com$1  [L,QSA]

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