htaccess for subdomains and domains

I have built a tool similar to wordpress where my clients can edit their website using my tool, they can use my subdomain or their domain. All my clients sites use the same file, index.php, then i have diferent templates and contents that they manage in the backoffice, all controled in php. I have the subdomain part working so far:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{HTTP_HOST} ^(.+?)$
RewriteRule .* /index.php?sitename=%1 [L]

this lets me find what site to show BUT now i want them to be able to use their own domain if they have one. Example:

they both open the same client website but if you try to open a link from the menu on it fails because it tries to open the folder, i want it to open index.php instead. My attempts always break the .css and .js files.

Source: New Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.