WordPress Problem to Pass External Domain as URL Query String Parameter Value

Today I have discovered a strange problem of WordPress / Apache. WordPress / Apache is unable to handle an URL with a query string parameter containing a link of external domain (Cross Domain). It shows not found page. I am trying call a static story.html file from my upload directory. I have to pass some query string with URL of my story.html file. But when I am trying to pass some query parameter in the URL then I am going to a not found page. I tried to figure out the main issue point. I tired in many ways by changing the parameter values.  At last I discovered that the problem is occurred when one of my parameter value contains a url of cross domain. This problem is occurred though my external URL is url-encoded. But when I use same domain url as a parameter value then no problem. What is my need? My story.html file has some javaScript codes to handle a API request from an external domain. So I have to pass the external API URL as a query parameter. I tested my experiment with an image file also. Same result. Test following URLs one by one

  1. http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg
  2. http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=sometext
  3. http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=http%3A%2F%2Fonetarek.com
  4. http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=http%3A%2F%2Fgoogle.com

My Problem has been solved, So you will not see any problem for above example urls. Test this URL style for your own website

First 3 URLs are showing the image file but 4th URL is showing not found page by WordPress. I tested this process in another non WordPress site, but there is no problem. I think this problem is happening only in WordPress website. I am trying to find out the main technical cause of this issue. I will update this post when I will find any solution. Please a write a comment if you know any solution.

WordPress and URL Query Parameter with External Domain Problem
Apache returns 404 for cross domain link in query string

Experiment and Discussions:

I wrote this problem on WordPress Support Forum. Read and join to my discussion thread.

I have tested with 7 different domains those are hosted in HostGator server. 2 of theme are non wp site and 5 are wordpress site.
1 wp and 1 non wp sites work fine. Other 5 sites returns not found. Here I am trying to prove that HostGator is an issue here.

My more experimental links are here

Discussions in ServerFault.com


I got the solution.
I asked to HostGator support. They told me that They run mod_security which is the cause of the problem. They ran a command to whitelist a mod_sec rule my site was hitting. You have to know detail about mod_security. If you have root control on the server, you could change it in php.ini


  1. omg Thank you! I am a web designer and I am hosting my clients wordpress/woocommerce site with hostgator. My clients supplier website connects with woocommerce to make loading products easy but because of hostgators mod-security rules, the supplier couldn’t connect to the site. The supplier gave an error message explaining that my hosting was the issue. I was able to explain to my hostgator rep both the problem and solution thanks to this post.

    The security rule id i needed them to whitelist in this situation was rule id: 1234234.


  2. Many thanks for this post. I prefer your blog very much and i am a huge fan of it.

    This is my first time posting here. I like this so much that I
    even shared on Bebo. Thanks again for the beautiful post.


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.