[Mediawiki-l] Moving MediaWiki domains and mod_rewrite

Robert L. DeSilets, Jr. desilets at isc.upenn.edu
Tue Aug 5 13:14:06 UTC 2008


Awhile back I had written in to look for mod_rewrite help in moving my
MediaWiki from one url to another.  I finally accomplished the move, while
still retaining the ability to correctly process any legacy hard-coded urls
that may be floating around. Now, any url addressed to:

http://old.domain.name:16080/index.php/Article_name

Will get properly redirected to

http://new.domain.name/wiki/Article_name

I followed the instructions available from MediaWiki to truncate the
servername within the Apache virtualhost config file, but also added the
following to an .htaccess file in the olddomainname directory to process
requests for the old domain name.

I am posting this in the helps that it will help with someone else's
migration needs:

# The lines below do the article and url translation:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^old.domain.name:16080$
RewriteCond %{REQUEST_URI} ^/index.php($|/.*$)
RewriteRule ^(.*) http://new.domain.name/wiki%1 [R=301,NC,L]

# The lines below take any other old.domain.name urls
# and redirects them to new.domain.name

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^old.domain.name$
RewriteCond %{REQUEST_URI} ^($|/.*$)
RewriteRule ^(.*) http://new.domain.name/wiki%1 [R=301,NC,L]

--
Robert L. DeSilets, Jr.
Sr. IT Support Specialist
ISC-CSG
desilets at isc.upenn.edu
(215)898-0067





More information about the MediaWiki-l mailing list