toben88
asked on
apache mod rewrite to do 301 redirects with .htaccess
I rebuilt my entire site from scratch and need to redirect all the old URL's to new ones. Unfortunately they are all over the place so the solution seems to use mod_rewrite with .htaccess. I know it can be done but I am having trouble getting the syntax to work. 500 points if you help me.
Here are some URL's I need to redirect. For each number there are usually 50 corresponding numbers.
so for the first one feedid=6 there is also a feedid=1, feedid=2, feedid=3 all the way to 50 or so.
Podcast feeds
from
http://www.domain.com/index.php?module=CTV&action=viewRss&feedid=6
to
http://www.domain.com/podcasts/rss/podcast/6
Podcast subscribe page
from
http://www.domain.com/index.php?module=CTV&action=subscribe&id=7
to
http://www.domain.com/podcasts/details/7
Channel feeds
from
http://www.domain.com/index.php?module=CTV&action=channel&cid=11
to
http://www.domain.com/channels/details/video/11
External channel feeds
from
http://www.domain.com/index.php?module=ctv&action=mediaCenter&cid=21
to
http://www.domain.com/channels/details/video/21
Specific Random URL to change
from
http://www.domain.com/index.php?module=CTV&action=mediaCenterPlayer&id=2138
to
http://www.domain.com/channels/details/video/21
Here is my existing .htaccess and it is working well.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !(^/crossdomain.xml)
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
AddType application/x-javascript .js
AddType text/css .css
</IfModule>
I am using apache 2.2.3 on Centos 5
Please be specific and you get 500 points!
Here are some URL's I need to redirect. For each number there are usually 50 corresponding numbers.
so for the first one feedid=6 there is also a feedid=1, feedid=2, feedid=3 all the way to 50 or so.
Podcast feeds
from
http://www.domain.com/index.php?module=CTV&action=viewRss&feedid=6
to
http://www.domain.com/podcasts/rss/podcast/6
Podcast subscribe page
from
http://www.domain.com/index.php?module=CTV&action=subscribe&id=7
to
http://www.domain.com/podcasts/details/7
Channel feeds
from
http://www.domain.com/index.php?module=CTV&action=channel&cid=11
to
http://www.domain.com/channels/details/video/11
External channel feeds
from
http://www.domain.com/index.php?module=ctv&action=mediaCenter&cid=21
to
http://www.domain.com/channels/details/video/21
Specific Random URL to change
from
http://www.domain.com/index.php?module=CTV&action=mediaCenterPlayer&id=2138
to
http://www.domain.com/channels/details/video/21
Here is my existing .htaccess and it is working well.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !(^/crossdomain.xml)
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
AddType application/x-javascript .js
AddType text/css .css
</IfModule>
I am using apache 2.2.3 on Centos 5
Please be specific and you get 500 points!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
found the solution here http://www.webhostgear.com/109.html
ASKER
http://www.domain.com/index.php?module=ctv&action=mediaCenter&cid=21
to
http://wwwdomain.com/channels/details/video/21/mediapage