Forum Moderators: phranque

Message Too Old, No Replies

How to redirect only URLs without GET data

Page is used for multple things, only want base URL redirected.

         

kenjas

7:34 pm on Apr 15, 2006 (gmt 0)

10+ Year Member



My index page has been spidered under the root / and /index.php and the engines think they're duplicate content. I have eliminated all internal site links to /index.php and now want to redirect any visitors who come in on /index.php to /.

The problem I have is that index.php sometimes has GET variables that cause the page to show other content. Basically I only want to redirect when index.php does not have any GET variables attached.

I tried this, but it gives me a redirect error:

RewriteRule ^index.php$ [mysite.com...]

Anybody know how to do this?

Thanks!

kenjas

8:32 pm on Apr 15, 2006 (gmt 0)

10+ Year Member



This seems to do the trick.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ [mystie.com...] [R=301,L]

kenjas

6:49 pm on Apr 16, 2006 (gmt 0)

10+ Year Member



Well I thought it did the trick, anyway... It seemed to work right in Firefox, but I was using a spider simulator to test it and found that URLs with GET parameters are also being redirected. The base index.php gets rerouted correctly in the spider simulator, but when GET parameters are attached it tells me it was redirected and it doesn't seem to find the right page. Not sure if it is a spider simulator bug or what, although I suspect it isn't.
<snip>
How do I rewrite that statement so that it ignores URLs that contain GET parameters?

[edited by: jdMorgan at 10:25 pm (utc) on April 16, 2006]
[edit reason] No URLs, please. See TOS. [/edit]

jdMorgan

10:25 pm on Apr 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is likely a spider simulator bug, as your rule is entirely correct to accomplish your stated goal.

Jim