Forum Moderators: phranque

Message Too Old, No Replies

Redirecting ? param to subfolder

Correct the Wordpress wrong URL

         

Rhobur

11:04 am on Sep 21, 2011 (gmt 0)

10+ Year Member



Hi,
I have read all related posts in 2011 but still can't get it to work, I must be a slow learner so please do not mind and give me a hint if you have time.
I have a wordpress blog installed in a subdirectory which is generating a lot of non existing URL which I find in google WMT. Basicaly, I want to redirect the [domain.ro ] where
12345678
is an variable 8 digit number to [domain.ro ]/
I am trying with
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blogg/
RewriteCond %{QUERY_STRING} ^m=([0-9]*)
RewriteRule ^$ http://www.domain.ro/subdirectory/? [L,R=301]

but still send me to [domain.ro ]http://www.domain.ro/subdirectory?m=12345678, instead of [domain.ro ]
Please help me with a hint of what am I doing wrong.
Thank you!

lucy24

6:48 pm on Sep 21, 2011 (gmt 0)

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



In the course of reading all those posts, did you happen to notice the Prime Directive?

Use example.com in your examples. Everything else is automatically converted to a clickable link. In this forum we need to be able to see exactly what you typed.

The lines

RewriteCond %{REQUEST_URI} ^/blogg/

and

RewriteRule ^$ {et cetera}

are mutually exclusive. The rule can never meet its required conditions.

Rhobur

7:50 am on Sep 22, 2011 (gmt 0)

10+ Year Member



Thanks for replying, I have tried without REQUEST_URI too but no success it keeps sending to [url]http://www.example.com/blogg?m=12345678[/url] instead of [url]http://www.example.com/blogg[/url]

g1smd

7:59 am on Sep 22, 2011 (gmt 0)

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



^$ matches only example.com/<blank path> not example.com/path (parameters are not considered by RewriteRule)

The rule can never work when the pattern is ^$ and the requested URL is not "/"

Rhobur

8:54 am on Sep 22, 2011 (gmt 0)

10+ Year Member



Thanks for your time, I tried
Options +FollowSymLinks -Indexes
RewriteEngine On

RewriteCond %{QUERY_STRING} ^m=([0-9]*)
RewriteRule http://www.example.com/blogg/? [L,R=301]


no success either.

g1smd

7:04 pm on Sep 22, 2011 (gmt 0)

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



The RewriteRule needs a RegEx pattern to match the incoming URL request. This will signify that this rule will run for this request.

You have no pattern. The rule is invalid.