开发者

htaccess RewriteCond to redirect and hyperlinks pointing to main domain to a subdomain

开发者 https://www.devze.com 2023-02-17 06:23 出处:网络
I need some assistance with htaccess and RewriteCond. On my subdomain http://staging.foo.com/ 开发者_JAVA百科I want to rewrite any hyperlinks with http://foo.org.uk as a prefix to my subdomain http:/

I need some assistance with htaccess and RewriteCond.

On my subdomain http://staging.foo.com/ 开发者_JAVA百科I want to rewrite any hyperlinks with http://foo.org.uk as a prefix to my subdomain http://staging.foo.org.uk by means of .htaccess.

Any ideas of what to put into the .htaccess file on staging.foo.com?


This isn't possible with mod_rewrite. It only acts on requests to the server, not content that is returned to the browser.

You could do something with PHP using prepend and append scripts. In the prepend script turn on output buffering, then in the append script get the output buffer contents, search/replace, then output again.

0

精彩评论

暂无评论...
验证码 换一张
取 消