Hello i want to convert my dynamic urls to static urls as follows
www.mysite.com/course_desc.php?id=5 ->www.mysite.com/informatica-online-training.htm
www.mysite.com/course_desc.php?id=7 ->www.mysite.com/cognos-online-training.htm
www.mysite.com/course_desc.php?id=8 ->www.mysite.com/datastage-online-training.htm
www.mysite.com/course_desc.php?id=26 ->www.mysite.com/business-objects-online-training.htm
The problem here was i had another 50 urls of this kind.so i want to apply the loop method as given below.its working fine but the problem was,the new static urls not displaying my content but it displaying my header,left menu,right menu and my bottom.Its not fetching data from database driven data.Can anybody give me the solution
# Externally redirect direct client requests for old/unfriendly/query-stringed URLs to new friendly URLs
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /course_desc\.php\?id=([0-9]+)\ HTTP/
RewriteCond %1>informatica ^5>(.+)$ [OR]
RewriteCond %1>cognos ^7>(.+)$ [OR]
RewriteCond %1>datastage ^8>(.+)$ [OR]
RewriteCond %1>business-objects ^26>(.+)$
RewriteRule course_desc\.php$ www.mysite.com/%1-online-training.htm? [R=301,L]
#
# Internally rewrite friendly URL requests to internal script filepaths
RewriteCond $1>5 ^informatica>(.+)$ [OR]
RewriteCond $1>7 ^cognos>(.+)$ [OR]
RewriteCond $1>8 ^datastage>(.+)$ [OR]
RewriteCond $1>26 ^business-objects>(.+)$
RewriteRule ^([^/\-]+)-online-training.htm$ /course_desc.php?id=1 [L]
I applied the the following individual code in my htaccess,i am able to rewrite and 301 them to the new clean static url.
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /course_desc\.php\?id=5\ HTTP/
RewriteRule ^course_desc\.php$ www.mysite.com/informatica-online-training.htm? [R=301,L]
RewriteRule ^informatica-online-training.htm$ /course_desc.php?id=5 [L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /course_desc\.php\?id=7\ HTTP/
RewriteRule ^course_desc\.php$ www.mysite.com/cognos-online-training.htm? [R=301,L]
RewriteRule ^cognos-online-training.htm$ /course_desc.php?id=7 [L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /course_desc\.php\?id=8\ HTTP/
RewriteRule ^course_desc\.php$ www.mysite.com/datastage-online-training.htm? [R=301,L]
RewriteRule ^datastage-online-training.htm$ /course_desc.php?id=8 [L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /course_desc\.php\?id=26\ HTTP/
RewriteRule ^course_desc\.php$ www.mysite.com/business-objects-online-training.htm? [R=301,L]
RewriteRule ^business-objects-online-training.htm$ /course_desc.php?id=26 [L]