Forum Moderators: phranque

Message Too Old, No Replies

One specific circumstance to 301 a URL

         

Asia_Expat

9:42 pm on Jan 1, 2007 (gmt 0)

10+ Year Member



I have an Invision installation that I have modified to be search engine friendly. However, there is one particular dupe content issue I can figure a way around and I'm sure there must be a way to do it with htaccess. I just can't figure it out though so I hope someone will help me.
Below is an example of a topic URL...

www.example.com/forum/index.php?showtopic=2414&st=0

The last part ( &st=0 ) produces exactly the same page as...

www.example.com/forum/index.php?showtopic=2414

... and so I want to 301 redirect the first example to the second example... but ONLY if '&st=0' is present.

If...
www.example.com/forum/index.php?showtopic=2414&st=20
... is the URL, the redirect MUST NOT happen... I can't work this out, sorry. Please help :-)

Thanks.

[edited by: jdMorgan at 1:05 am (utc) on Jan. 2, 2007]
[edit reason] examplified, re-formatted [/edit]

Asia_Expat

9:47 pm on Jan 1, 2007 (gmt 0)

10+ Year Member



Just in case it is significant, here is my current root directory htaccess file...

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ h##p://www.example.com/$1 [r=301,nc]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ h##p://www.example.com/ [R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteRule ^index\.php$ /this_file_does_not_exist.html? [L]

redirect 301 /exampledir/examplefile.html http://www.example.com/examplefile2.html

[edited by: Asia_Expat at 9:48 pm (utc) on Jan. 1, 2007]

jdMorgan

1:11 am on Jan 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The last rule in your code will rewrite all requests for index.php with any non-blank query string to "this_file_does_not_exist", in all likelihood producing a 404-Not Found response.

This will interfere with any rule you might add to redirect your "st=0" requests.

If you have tried other rules to redirect this query, please post them so we can discuss them.

Jim