What I'm trying to do is automate the process of moving from websites. These websites are dynamically created using htaccess, so here is an example:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(.*)$ /folder%{REQUEST_URI}?%{QUERY_STRING} [QSA,L]
What I am doing is adding a domain alias for domain.com, and then pointing it to my server IP address, and the htaccess file allows me to see what is in the / folder.
It works great, but we plan to have hundreds of websites and adding this piece of code to htaccess manually can be quite annoying. Since all I am changing is domain.com and / folder, is there a way to use PHP to dynamically add the .htaccess file to the bottom of the file, if I create a form and tell it the domain and folder, will it add it to the bottom of the htaccess file?
This will save so much time.
Many thanks.
source
share