Search

Hello

I just migrated an old Expression Engine blog to Symphony and now I need to forward the old URLs to the new ones.

The old URL structure looks like this:

http://www.mywebsite.com/index.php/global/article/symphony-voted-best-cms-ever

And the new one like this:

http://www.mywebsite.com/blog/article/symphony-voted-best-cms-ever

Any idea how this can be done?

I already tried the URL Router extension which looks great but can't handle legacy URLs (it seems?). Adding rewrite rules to Symphony's .htaccess file might be an option. But I'm worried that this might affect any existing rewrite rules in that file.

Thanks for any help.

URL Router should do, I think. Something along the lines of:

From:

/\/index\.php\/global\/article\/(.*?)\//i

To:

/blog/article/$1/

The dot must be escaped.

Thanks but the index.php bit is causing some trouble.

It seems to be re-directing everything after the root, including image paths etc.

Is there any way to fix this?

This works, however:

/\/global/article\/(.*?)\//i

To:

/blog/article/$1/

If your webserver is set to serve files that exist on the filesystem directly to the browser without invoking PHP, I wouldn't have thought images would be an issue. If using Apache, I believe Symphony's default .htaccess file does direct Apache to serve real files directly.

Could you give examples of some routes which are being redirected that shouldn't be?

For example the logo of the website.

Is is stored under http://www.mywebsite.com/workspace/images/logo.png.

But when I set up the routes as suggested by animaux and then hit http://www.mywebsite.com/index.php/global/article/symphony-voted-best-cms-ever, the page-not-found template gets served and the logo path gets replaced with http://www.mywebsite.com/index.php/workspace/images/logo.png which is not what I want.

Could you post your .htaccess file (if it's Apache you're using) and a screenshot of URL Router's routes in the Symphony UI?

### Symphony 2.6.x ###
Options +SymLinksIfOwnerMatch -Indexes

<IfModule !mod_rewrite.c>
    SetEnv HTTP_MOD_REWRITE No
</IfModule>

<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine on
    RewriteBase /

    ### SECURITY - Protect crucial files
    RewriteRule ^manifest/(.*)$ - [F]
    RewriteRule ^workspace/(pages|utilities)/(.*).xsl$ - [F]
    RewriteRule ^(.*).sql$ - [F]
    RewriteRule (^|/). - [F]

    ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
    RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
    RewriteRule .* - [S=14]


    ### SASS RULES
    RewriteRule ^sass/(.+.sass)$ extensions/sass_compiler/lib/sass.php?mode=sass&param=$1 [L,NC]
    RewriteRule ^scss/(.+.scss)$ extensions/sass_compiler/lib/sass.php?mode=scss&param=$1 [L,NC]


    ### IMAGE RULES
    RewriteRule ^image/(.+)$ extensions/jit_image_manipulation/lib/image.php?param=$1 [B,L,NC]

    ### CHECK FOR TRAILING SLASH - Will ignore files
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ $1/ [L,R=301]

    ### URL Correction
    #RewriteRule ^(symphony/)?index.php(/.*/?) $1$2 [NC]
    RewriteRule ^(/)?index.php(/.*/?) $1$2 [NC]

    ### ADMIN REWRITE
    RewriteRule ^symphony/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^symphony(/(.*/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING}   [NC,L]

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

</IfModule>
######
Attachments:
screen.png

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details