My organization is retiring one CMS platform and migrating to another. For the transition we want to do one-to-one redirects for hundreds of pages. I have been using the following syntax as it seems to work. If I lump them all in one .conf file in the conf.d folder and enclose them in the <VirtualHost> tag it works, though this is not the way I would like.
RewriteRule ^/display/somespace/sometitle$ https://thenewcms.myorg.com/sites/newspace/newtitle [R=301,NC,L]
So it works when I put them all in one particular .conf file that already existed in the conf.d folder:
<VirtualHost *:80>
ServerName oldcms.myorg.com
Redirect permanent / https://oldcms.myorg.com/
</VirtualHost>
<VirtualHost *:443>
RewriteEngine On
RewriteRule ^/display/somespace/sometitle1$ https://newcms.myorg.com/sites/newspace/newtitle1 [R=301,NC,L]
RewriteRule ^/display/somespace/sometitle2$ https://newcms.myorg.com/sites/newspace/newtitle2 [R=301,NC,L]
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES
SSLCertificateFile /etc/httpd/certs/prod.crt
SSLCertificateKeyFile /etc/httpd/certs/wildcard.myorg.com.key
SSLCertificateChainFile /etc/httpd/certs/wildcard.myorg.com_bundle.crt
ServerName oldcms.myorg.com
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
</VirtualHost>
For manageability, I would rather that the conf.d folder has many individual .conf files, each file having a subset of the huge number of total redirects. The content owners are sending me spreadsheets of the old and new urls and I am converting those into RewriteRules. It would be nice to have a one-to-one relationship between a spreadsheet and a .conf file.
I have tried putting the entire <VirtualHost> tag with all the SSL, logging, proxy, etc., in each of the files, as well as a small portions of what is in the <VirtualHost> tag. I had it working at one point, but I forget which combination worked, as I kept removing lines to see what the minimum required was.
It seems like I don't need to repeat the <VirtualHost> tag over and over in each of these individual .conf tags. It would be nice if these individual .conf files simply had the RewriteRule lines that directly related to the spreadsheets that the content owners are sending me.
I'm open to doing it a completely different way too. I don't want to mess with the main httpd.conf, but I will if necessary. Maybe use .htaccess, but I think that slows things down.
An extra bonus would be to have a subfolder under conf.d to put all these so the conf.d folder is not so cluttered. I suppose that would mean adding another Include in httpd.conf.