I have a question about redirects

3 replies
  • WEB DESIGN
  • |
I am trying to write a jquery code that will redirect from one page to another domain ONLY IF there is a certain utm_source that people come from to get to the redirecting page. How can this be done?
#question #redirects
  • Profile picture of the author jbearnolimits
    Here is an idea that was given by someone. What do I need to change in the code to make the page redirect if the utm src=thispage? I would be redirecting to "newpage".

    Code:
    <script type="text/javascript">
       $(document).ready( function() {
    RewriteCond %{QUERY_STRING} utm src=thispage
    RewriteRule .* / [R,L]
       });
    </script>
    {{ DiscussionBoard.errors[9425988].message }}
    • Profile picture of the author Michael71
      Originally Posted by jbearnolimits View Post

      Here is an idea that was given by someone. What do I need to change in the code to make the page redirect if the utm src=thispage? I would be redirecting to "newpage".

      Code:
      <script type="text/javascript">
         $(document).ready( function() {
      RewriteCond %{QUERY_STRING} utm src=thispage
      RewriteRule .* / [R,L]
         });
      </script>

      You got something wrong, the code I gave you is for your .htaccess file, not jQuery

      What you have pasted will never work.

      if you want jQuery check this:

      http://stackoverflow.com/questions/4...a-given-string
      Signature

      HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
      ---
      Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

      {{ DiscussionBoard.errors[9427267].message }}
    • Profile picture of the author ThomasDWright
      Originally Posted by jbearnolimits View Post

      Here is an idea that was given by someone. What do I need to change in the code to make the page redirect if the utm src=thispage? I would be redirecting to "newpage".

      Code:
      <script type="text/javascript">
         $(document).ready( function() {
      RewriteCond %{QUERY_STRING} utm src=thispage
      RewriteRule .* / [R,L]
         });
      </script>
      You had used .htaccess file, the code for jquery is different.
      {{ DiscussionBoard.errors[9440898].message }}

Trending Topics