0
votes

I have a dedicated server with many parked domains, my subfolders have the structure "domain.com/pages/username" and if the user purchases a own domain then do the redirect with this code in htaccess file:

    RewriteCond% {HTTP_HOST} ^ mynewdomain\.com $ [NC]
    RewriteCond% {DOCUMENT_ROOT} /pages/username/% {REQUEST_URI} /-d
    RewriteRule [^ /] $% {REQUEST_URI}/ [R = 301, L] 
    RewriteCond% {ENV: REDIRECT_STATUS} ^ $
    RewriteCond% {HTTP_HOST} ^ mynewdomain\.com $ [NC]
    RewriteRule ^ (. *) $ /pages/username/$ 1 [QSA, L] 

But now as there are several domains and htaccess file size is getting larger. I wondered if something similar can be done from the domain configuration without editing the htaccess file. I do not use subdomains, Can I use CNAME or something similar for new domains? htaccess file weight affects page load?

Is it possible?

Thanks guys.

1

1 Answers

0
votes

If you're the server administrator, you should not be using htaccess files for your configuration, you should be making the changes in the main config file for your server. If you're using Apache on Linux, this is typically located in /etc/apacheX/sites-available/. The exact same rules can be applied in a Directory section in the main configuration file.

See here for information on when not to use htaccess files.