Search

Padexx, If you mirror the setup in #comment-12 you should be able to get into the backend as well. I have encountered issues with the separation of rules as Michael-e had indicated so have reverted to what I have posted until I understand why this is.

I found that indeed, the admin rewrites were being altered due to the order in which the rewrites are placed in the file. Try and follow what I've done in there to the letter and you should be fine. But as Michael-e said, updates to the symphony core in the future may affect the .htaccess rules you have set. So short term solution try mine, failing that Michael-e may have more insight into why it isn't triggering as expected.

I know that this kind of stuff can be very tricky, but unfortunately I can't test it right now and help you debug this. Please don't take the Ninja Domains tutorial as eternal truth, it was more like an experiment and it just worked for me. But there are more ways to solve this kind of stuff. (I am even running hundreds of domains/websites on one Symphony installation, and you wouldn't do this with .htaccess at all.)

That said, if you find an error or can improve the Ninja Domains technique, please post your findings here!

Thank you both for your time! I've taken the "splitted" solution which seems to work fine for now. I'll keep an eye on it after each symphony update...

moonoo2 I think there are a few typos in your posted htacces code. (DOMAIN REWRITES domain1<->domain2)

Here is what worked for me (no ?debug):

### Symphony 2.3.x ###
Options +FollowSymlinks -Indexes

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /

    ### GLOBAL REWRITE (remove www)
    RewriteCond %{HTTP_HOST} ^www.domain1.com$ [NC]
    RewriteRule ^(.*)$ http://domain1.com/$1 [R,L]

    RewriteCond %{HTTP_HOST} ^www.domain2.com$ [NC]
    RewriteRule ^(.*)$ http://domain2.com/$1 [R,L]

    ### DOMAIN1 REWRITES
    RewriteCond %{HTTP_HOST} domain1.com$ [NC]
    RewriteRule ^domain2/?(.*/?)$ http://domain2.com/$1 [R,L]
    RewriteRule ^domain2$ http://domain2.com/ [R,L]

    ### DOMAIN2 REWRITES
    RewriteCond %{HTTP_HOST} domain2.com$ [NC]
    RewriteRule ^domain1/?(.*/?)$ http://domain1.com/$1 [R,L]
    RewriteRule ^domain1$ http://domain1.com/ [R,L]

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

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

    ### IMAGE RULES
    RewriteRule ^image/(.+.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [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]

    ### 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]

    ### DOMAIN1 PAGE REWRITES
    RewriteCond %{HTTP_HOST} domain1.com$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*/?)$ index.php?symphony-page=domain1/$1&%{QUERY_STRING} [L]

    RewriteCond %{HTTP_HOST} domain1.com$ [NC]
    RewriteRule ^$ index.php?symphony-page=domain1 [L]

    ### DOMAIN2 PAGE REWRITES
    RewriteCond %{HTTP_HOST} domain2.com$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*/?)$ index.php?symphony-page=domain2/$1&%{QUERY_STRING} [L]

    RewriteCond %{HTTP_HOST} domain2.com$ [NC]
    RewriteRule ^$ index.php?symphony-page=domain2 [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>
######

Ahh oops! yes.. the if you access domain2 url from www.domain1.com redirect yes? Sorry.. I amended my code to protect my developer url's so may have posted the wrong redirects there. appologies.

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