Forum Moderators: phranque

Message Too Old, No Replies

XMLRPC problem with .htaccess Rewrite

xmlrpc, htaccess, rewrite, joomla

         

dirtymonkey

1:00 pm on Nov 25, 2009 (gmt 0)

10+ Year Member



Hi,

I am getting the following error where XMLRPC query to server seems to be passed correctly but we receive the following error. Didn't receive 200 OK from remote server. (HTTP/1.1 301 Moved Permanently)

From the code below in conjunction with Joomla:


########## Begin - Rewrite rules to enhance SEO SEF
#
# RewriteCond %{HTTP_HOST} ^mydomain\.com [NC,OR]
# RewriteCond %{HTTP_HOST} ^www\.mydomain\.com\. [NC,OR]
# RewriteCond %{HTTP_HOST} ^www\.mydomain\.com:[0-9] [NC]
# RewriteCond %{SERVER_PORT}>s ^(443>(s)¦80>s)$
# RewriteRule (.*) http%2://www.mydomain.com/$1 [R=301,L]
#
########## End - Rewrite rules to enhance SEO SEF

Now I'm no expert but do I need to exclude XMLRPC from Rewrite or something?

Thanks in advance, DM.

jdMorgan

3:15 pm on Nov 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd say try it and see... And you can also shorten/improve this code, some of which was apparently copied without attribution from one of my posts in this forum -- or from some other source which was copied from here... that ">" in the http/https preservation function is a dead give-away. :)

########## Begin - Rewrite rules to enhance SEO SEF
#
# Externally redirect to canonical hostname, preserving the original
# request's http/https protocol, but excluding xmlrpc requests.
# RewriteCond $1 !xmlrpc [NC]
# RewriteCond %{HTTP_HOST} ^(mydomain\.com¦www\.mydomain\.com(\.¦\.?[0-9]+)$) [NC]
# RewriteCond %{SERVER_PORT}>s ^(443>(s)¦80>s)$
# RewriteRule ^(.*)$ http%2://www.mydomain.com/$1 [R=301,L]
#
########## End - Rewrite rules to enhance SEO SEF

Replace the broken pipe "¦" characters in both RewriteConds with solid pipe characters before use; Posting on this forum modifies the pipe characters.

[added] If this 'fixes' the problem, then go back and look at the code that's doing XML remote procedure calls, and fix it so that it requests the canonical domain. If it was properly configured, you would not be seeing this problem. Having corrected that configuration error, you can remove the exception from the rule. [/added]

Jim

dirtymonkey

9:31 pm on Nov 25, 2009 (gmt 0)

10+ Year Member



Hi Jim, well spotted the code does indeed originate from your good self. Unfortunately I'm not proficient enough to be able to modify anything other than the 'bleeding obvious' so I copied verbatim. ;)

I will follow your lead and refine hence-with!

Respect, DM.