Internet Related/Filtering/Firewall Thread, Apache rewrite in Technical; Can anyone explain to me how to use Mod Rewrite in Apache 2 to do the following?
I want to ...
11th January 2013, 12:10 PM #1
Can anyone explain to me how to use Mod Rewrite in Apache 2 to do the following?
I want to rewrite any mention of 'servername' with 'differentservername'.
So basically, if the site has an absolute link http://servername/blah.jpg it should instead return http://differentservername/blah.jpg
11th January 2013, 12:33 PM #2
You could use a redirect. I had to do a similar thing for our Apache server when we changed our domain name and it works how you describe.
Redirect permanent / http://differentservername/
11th January 2013, 12:37 PM #3
That isn't any use to us - it is reverse proxied so the server is not internet facing.
I'm looking at ProxyHTMLURLMap at the moment, using mod_proxy_html.
11th January 2013, 12:49 PM #4
I'll explain my issue further - on this site, rather than use relative urls in the CSS 'style' code, they've used full server domains - eg:
Rather than the more elegant way of doing it:
So, the way I was thinking I should do it would be:
But it doesn't seem to be rewriting...
ProxyPass / http://server/
ProxyHTMLURLMap http://server/ /
11th January 2013, 12:51 PM #5
Would this work?
Redirect 301 http://servername/blah.jpg http://differentservername/blah.jpg
11th January 2013, 12:54 PM #6
No. That wouldn't rewrite anything - it'd just redirect any requests to the server for http://servername to http://differentservername - but as I said, differentservername is not an internet facing server - it is being reverse proxied.
Originally Posted by Arthur
11th January 2013, 01:04 PM #7
I got it working by changing some other settings instead.
By russdev in forum Web Development
Last Post: 29th December 2010, 03:57 PM
By Michael_84 in forum Web Development
Last Post: 1st December 2008, 01:57 PM
By in forum Web Development
Last Post: 27th April 2006, 10:29 AM
Last Post: 7th March 2006, 04:12 PM
Last Post: 14th November 2005, 11:35 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)