Search code examples
wordpress.htaccessexpressionengine

Redirect to Wordpress from an external site (EE) appends a ? at the end of the URL


I'm pretty sure this is the first time I have had this issue so I wasn't sure where to look.

The company I work for has a client site which was built in Expression Engine, they now have a new site built with Wordpress. On the old site, they wanted to link to the new Wordpress site through a "Charities" link.

As EE was terrible at dealing with external links, I decided to add a redirect within the .htaccess. The only trouble is, when the link is clicked, the Wordpress site has a "/?charities/" appended to the end URL.

Here is the .htaccess code...

AddType text/x-component .htc

RewriteEngine On

RewriteBase /

Redirect 301 /charities http://www.retail4charities.co.uk

#Handle comment redirection
RewriteCond %{THE_REQUEST} !^POST
RewriteRule ^template_group/?(.*)$ /$1 [R=301,L]

#Handle removal of index.php and template group from EE URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(images|logocms|themes|index\.php|admin\.php) [NC]
RewriteCond %{QUERY_STRING} !^ACT=
RewriteRule ^(.*)$ index.php?$1 [L]

For a working example, head over to http://kudos-software.co.uk and click the charities link to see what is going on.

Any help on this would be greatly appreciated.


Solution

  • Better to use mod_rewrite for this. Switch that line out with this one:

    RewriteRule ^charities$ http://www.retail4charities.co.uk [R=302,L]
    

    Change 302 to 301 to make the redirect permanent (cached).