Forum Moderators: phranque

Message Too Old, No Replies

301 htaccess redirect help

301 htaccess redirect help

         

awidea

1:04 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



Hi,

How to create a htaccess redirect for such url

/dossiers_artikel.php?mainID=6&subID=5&contentID=60

to

[noordzee.nl...]

I tried

redirect 301 /dossiers_artikel.php?mainID=6&subID=5&contentID=60 [noordzee.nl...]

Please help me.

g1smd

1:07 pm on Sep 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is a question that is asked here almost every day.

As per forum charter, let's see your code. Use previous answers (there are thousands) for guidance.

Use a RewriteRule (not Redirect) and remember that RewriteRule sees only the path part of the request. Use a RewriteCond to look at QUERY_STRING.

Use example.com in the forum to suppress auto-linking.

awidea

1:09 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



Hi g1smd,

Thank you very much for the reply. I am very new for this. I have no idea for it. Can you Please write a line how I should do it?

Thank you!

wilderness

1:25 pm on Sep 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Search for each of the following:

"?" (101,000 results), "QSA" (481 results), and "string" (10,600 results) and you'll find thousands of line examples.

BTW g1smd is in a different time zone and is currently copping some Z's, or at least should be.

awidea

1:29 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



Anyone to give Proper example Please?

awidea

2:00 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



I tried it like this
RewriteCond %{QUERY_STRING} ^mainID=6&subID=5&contentID=95$
RewriteRule ^/dossiers_artikel/.php [noordzee.nl...] [R=301,L]

still not working....

g1smd

2:07 pm on Sep 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Omit first / - paths are localised "per directory" before being presented to mod_rewrite.

Change second / to be \ - you need to escape the literal period.

You should also set your rules so that if the parameters are requested in a different order, the redirect should still occur.

Use example.com in the forum to suppress auto-linking.

awidea

2:15 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



Tried this nothing happen.
RewriteCond %{QUERY_STRING} ^mainID=6&subID=5&contentID=95$
RewriteRule ^\dossiers_artikel/.php [noordzee.nl...] [R=301,L]

awidea

3:41 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



No one can help?

g1smd

8:15 pm on Sep 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The words "first" and "second" in my earlier post seem to have been misinterpreted.

I don't how much more clear I need to write it.

awidea

8:26 pm on Sep 2, 2011 (gmt 0)

10+ Year Member



Thanks for your reply. I fixed it with a plugin.

wilderness

1:07 am on Sep 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't how much more clear I need to write it.


g1smd,
A copy and paste solution is much clearer ;)