.htaccessmod-rewriteurl-rewritingsymphony-cms

How to re-direct blog article URLs?


I am trying to redirect a bunch of old blog article URLs using the .htaccess file:

RedirectMatch ^/index\.php/global/article/(.*)$ http://www.mywebsite.com/blog/article/$1

This doesn't really work, however, because my CMS seems to get confused by the index.php bit and keeps adding ?symphony-page= to all the URLs.

It's probably this part that is responsible:

### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING}    [L]

Can anybody help?


Solution

  • Please try the following (comments included to explain):

    RewriteEngine On
    
    # First, redirect the old URIs to the new ones via a 301 redirect.
    # This will allow the CMS to take over using the rules that follow.
    RewriteRule ^index.php/global/article/(.+)$ /blog/article/$1 [L,R=301]
    
    # Frontend Rewrites - for the CMS
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L]