Skip to content
Apache module for replacing OLD urls to NEW urls.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CMakeLists.txt
Makefile.in
README.md
build.sh
clean_build.sh
config.m4
httpd.conf
index.html
mod_url_replace.c

README.md

mod_url_replace

Replace OLD urls to NEW urls based on mod_substitute.c

LoadModule url_replace_module modules/mod_url_replace.so
...
<Directory "/Users/likejazz/workspace/github/httpd-build/htdocs">
...
    # Replace OLD to NEW servers.
    SetOutputFilter URL-REPLACE
</Directory>

DEMO

Source

$ cat index.html
<h1>https://t1.search.daumcdn.net/argon/0x200_85_hr/IHxzswBdipQ</h1>
<h1>https://t2.search.daumcdn.net/argon/0x200_85_hr/ClTWD6PQvux</h1>
<h1>https://t4.search.daumcdn.net/argon/0x200_85_hr/GWIqfBjaDrt</h1>

Service

$ echo "GET / HTTP/1.0\n" | nc localhost 8080
HTTP/1.1 200 OK
Date: Thu, 16 Jul 2015 11:29:06 GMT
Server: Apache/2.2.29 (Unix)
Last-Modified: Thu, 16 Jul 2015 09:22:27 GMT
ETag: "2057850-cf-51afa9c1f5ac0"
Accept-Ranges: bytes
Connection: close
Content-Type: text/html

<h1>https://t1.search.daumcdn.net/argon/0x200_85_hr/IHxzswBdipQ</h1>
<h1>https://t99.search.daumcdn.net/argon/0x200_85_hr/ClTWD6PQvux</h1>
<h1>https://t99.search.daumcdn.net/argon/0x200_85_hr/GWIqfBjaDrt</h1>

It will convert OLD urls to NEW urls automatically. You don't have to do ANYTHING.

Installation

Edit PATHs in modules/url-replace/build.sh before building.

$ sh build.sh

You can see mod_url_replace.so in modules directory from build output.

You can’t perform that action at this time.