Redirects, a forum discussion on Jojo CMS. Join us for more discussions on Redirects on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS

24 Dec 2009
Posts: 11

Currently, I have a dynamic php site, using variables with his index.php.

I tried to modify my .htaccess to redirect the old URL with
RewriteCond %{QUERY_STRING} [&]?q=test[&]?
RewriteRule ^/$ [R=301,L]
but this did not work.

there is also the option within the CMS itself, I tried different lines, but I just cant get it right.

I need to redirect 301 to (this from the 'old' index.php?q=test which does not exist anymore to the new jojocms url /test/)

anyone knows how?


Core Developer


24 Dec 2009
Posts: 327

You should try the jojo_redirect plugin. In the "from" enter "?q=test" and in the "to" field, enter "test".

If that doesn't work (I have never really needed to use this with query strings) then try the following...

  • Create a global.php file in your theme, if it doesn't already exist.
  • Run setup by visiting if you had to create global.php (this is required after adding any new php files to a theme / plugin).
  • Add the following code to global.php
    if (isset($_GET['q']) && ($_GET['q'] == 'test') {
    Jojo::redirect(_SITEURL.'/test/', 301);

You can also do this using .htaccess if you like. There are tutorials out there on how to do this, Jojo doesn't do anything tricky with .htaccess other than forward all requests to index.php - make sure you put your code in the .htaccess file before Jojo does this (ie your code should come straight after the RewriteBase line)

24 Dec 2009
Posts: 11

Hello harvey

With the redirect plugin the redirect doesnt work,

with the code in the global.php I get this error:

Parse error: syntax error, unexpected '{' in /httpd.www/themes/refresh/global.php on line 2

26 Dec 2009
Posts: 11


I managed to create the redirect (after many would fail) in .htaccess with this line:

RewriteBase /
RewriteCond %{QUERY_STRING} ^q=testtest$
RewriteRule ^$ [R=301,L]

Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply

You need to Register or Log In before posting on these forums.