Support ⇒ Troubleshootings ⇒ Redirect no longer working ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexTroubleshootings

Redirect no longer working Reply to topic


Long time no speak! Hope all is well.

I have used a redirect script in my pronews pages to allow me to use a menu block to access different modules easily. For example, clicking Downloads takes me to an article with the following in it:

<script language="javascript"> window.location.href = "http://www.chantillyexpat.com/Downloads/c=9.html" </script>


This used to work fine, but now does nothing. Chrome reports this error on the line starting <script...

Uncaught SyntaxError: Unexpected token <

I haven't updated anything. Any thoughts?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


have you tried with:


<script> window.location.href = "http://www.chantillyexpat.com/Downloads/c=9.html"; </script>

there is a ; missing at the end of the line.

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


No, hasn't made a difference...

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Must be something above <script>. Do you have a link to the page?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


See here

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


<br /> window.location.href = "http://www.chantillyexpat.com/Downloads/c=9.html";<br /> </script></div>

The source code shows this.
there is no opening script tag and you have a couple of <BR /> there.

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


When looking at the source, you've placed the code inside the description textarea.
That area uses nl2br() so every line gets a <br/> and that field is also placed in the header meta elements.
So, make it 1 line like:
<script>window.location.href = "http://www.chantillyexpat.com/Downloads/c=9.html";</script>
It's still not the best solution. Better use mod_rewrite as bots like Google don't follow the script redirect.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


DJ Maze wrote
When looking at the source, you've placed the code inside the description textarea.
That area uses nl2br() so every line gets a <br/> and that field is also placed in the header meta elements.
So, make it 1 line like:
<script>window.location.href = "http://www.chantillyexpat.com/Downloads/c=9.html";</script>
It's still not the best solution. Better use mod_rewrite as bots like Google don't follow the script redirect.


Haha, perfect, thank you. Not too bothered about the bots at the moment so thanks for looking at this and getting to the bottom of it...

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

All times are UTC


Jump to: