Yet another .htaccess rewrite question... But can't find a way to make it work
My goal :
My best shot below makes a redirect, which I don't want.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com$
RewriteRule ^(.*)$ http://another.domain.com/specific/url [L]
This cannot be done using RewriteRule
- from the Apache docs :
Absolute URL
If an absolute URL is specified, mod_rewrite checks to see whether the hostname matches the current host. If it does, the scheme and hostname are stripped out and the resulting path is treated as a URL-path. Otherwise, an external redirect is performed for the given URL.
You may want to use a workaround, eg reading the page http://another.domain.com/specific/url
with Curl and then outputting the contents using echo()
(if you're using PHP). Anyway it looks like a hard-to-maintain 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.