need help with mod rewrite

New to mod_rewrite? This is a good place to start.

need help with mod rewrite

Postby aschen852 » Mon Oct 05, 2009 10:56 am

we are changing the domain name and context root of our application. I need to redirect as follows:

beta.creditportal.ratingsdirect.com/spd/* should go to beta.globalcreditportal.com/ratingsdirect/*

Most example I've seen are only for the domain as a whole and the query string. What's throwing me off is how to change the context root (spd to ratingsdirect) and everything that comes after.

Any help is appreciated.

Thanks,
aschen852
 
Posts: 1
Joined: Mon Oct 05, 2009 10:53 am

Postby richardk » Mon Oct 05, 2009 12:21 pm

A simple redirect (mod_dir) in old.example.com/.htaccess should be fine
Code: Select all
Redirect 301 /spd http://new.example.com/ratingsdirect


Or with mod_rewrite, specifically matching the old domain
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^old\.example\.com$ [NC]
RewriteRule ^spd(/(.*))?$ http://new.example.com/ratingsdirect/$2 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 26 guests

cron