Forum Moderators: phranque
i want to redirect theseurls with same string some examples are
www.example.com/sms/jokes.php?joke_id=30&cat_id=33&jtype=
www.example.com/sms/jokes.php?joke_id=30&cat_id=33&jtype=1
www.example.com/sms/jokes.php?joke_id=5577&cat_id=20&jtype=
www.example.com/sms/jokes.php?joke_id=5577&cat_id=20&jtype=1
to
www.example.com/sms/jokes.php?joke_id=30&cat_id=33
www.example.com/sms/jokes.php?joke_id=5577&cat_id=20
means in simple words i want to remove string "jtype" ANd "jtype=1"
from the end of url
and
for
www.example.com/sms/jokes_category.php?cat_id=66&jtype=
www.example.com/sms/jokes_category.php?cat_id=66&jtype=1
www.example.com/sms/jokes_category.php?cat_id=100&jtype=
www.example.com/sms/jokes_category.php?cat_id=100&jtype=1
to
www.example.com/sms/jokes_category.php?cat_id=66
www.example.com/sms/jokes_category.php?cat_id=100
Will u post the exact coding here so that i can add in .httacess and
get rid of these links
Then post your code as a basis for discussion.
Thanks,
Jim
I had to change directories from "coaching-results" to "coaching-records" but also had quite a few with extra text at the end of the url. I tried this, but it did not work.
RewriteRule ^/db/coaching-results/1/coach-1-name/(.*)$ [mydomain.com...] [L,R]
if someone knows where I'm going wrong I think it would help both of us.
[webmasterworld.com...]
Note, also, that [R] returns a 302 redirect, when you maybe need a 301.
example url
www.example.com/sms/jokes_category.php?cat_id=66&jtype=1
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} .
RewriteRule ^(.*)\.php\?(cat\ id=.*)&$ /$1.php?$2 [R=301,L]
Code in www.example.com/.htaccess :
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^(joke_id=[^&]+&cat_id=[^&]+)&jtype=
RewriteRule ^sms/jokes\.php http://www.example.com/sms/jokes.php?%1 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^(cat_id=[^&]+)&jtype=
RewriteRule ^sms/jokes_category\.php http://www.example.com/sms/jokes_category.php?%1 [R=301,L]
Jim