Forums

How to use RewriteRules (1 post)

  1. yokima
    Member
    Posted 3 years ago #

    Hello,

    I am combining WordPress and MediaWiki and I have this simple task:

    intercepting URLs requests that look like this
    http://krcla.org/w-en/index.php?title=Special:UserLogin&returnto=Korean_Resource_Center

    and sending them off to this address: http://krcla.org/blog/wp-login.php?&redirect_to=http://krcla.org/en2/Korean_Resource_Center

    I looked up a similar project here:
    http://wiki.case.edu/CaseWiki:External_Authentication#Intercepting_Calls_to_Special:Userlogin

    and came up with this code on /.htaccess, but obviously it's not working...

    RewriteCond %{REQUEST_URI} ^/w-en/index.php$
    RewriteCond %{QUERY_STRING} ^returnto$
    RewriteCond %{REQUEST_METHOD} ^GET$
    RewriteRule ^(.*)returnto\=(.*)$ ^$1redirect_to=http://krcla.org/en2/$2$ [R,L,N]

    RewriteCond %{REQUEST_URI} ^/w-en/index.php$
    RewriteCond %{QUERY_STRING} ^title=Special:UserLogin
    RewriteCond %{REQUEST_METHOD} ^GET$
    RewriteRule ^(.*)$ http://krcla.org/blog/wp-login.php [R,L,N]

    The second ReWriteRule does what it's supposed to do, which is sending people off to wp-login.php

    So with the above htaccess, this link:
    http://krcla.org/w-en/index.php?title=Special:UserLogin&returnto=Korean_Resource_Center

    becomes this:
    http://krcla.org/blog/wp-login.php?title=Special:UserLogin&returnto=Korean_Resource_Center

    But I still want to replace the string "returnto=" to "redirect_to=http://krcla.org/en2/"

    Ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by yokima
  • This topic is not a support question
  • WordPress version: 2.6