dat » inglese http://dat.perdomani.net infastidito Sat, 15 Jan 2011 18:56:53 +0000 en hourly 1 http://wordpress.org/?v=3.3.2 Drupal, hide install text files using rewrite rules http://dat.perdomani.net/2007/01/30/drupal-hide-install-text-files-using-rewrite-rules/ http://dat.perdomani.net/2007/01/30/drupal-hide-install-text-files-using-rewrite-rules/#comments Tue, 30 Jan 2007 14:32:32 +0000 dat http://dat.perdomani.net/2007/01/30/drupal-hide-install-text-files-using-rewrite-rules/ I see lots of web sites that are using drupal cms, and most of them are not hiding the text files that the installation process leave in the root directory. This is not a problem in general, but if you use an old version of drupal maybe is better not to show the world the version you are using. Take a look at drupal.org changelog file (yes this site is supposed to be up of date;).

So I use this basic solution, note that I update drupal using cvs method so I hide also the CVS directories. Put this code in your .htaccess file after RewriteEngine on inside the IfModule mod_rewrite.c section:

RewriteRule ^(.*)CHANGELOG\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)INSTALL\.mysql\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)INSTALL\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)MAINTAINERS\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)CVS$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)CVS/$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)INSTALL\.pgsql\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)LICENSE\.txt$ http://www.perdomani.net [R,L]
RewriteRule ^(.*)UPGRADE\.txt$ http://www.perdomani.net [R,L]

Modify to fix your needs and save the .htaccess file.

F.A.Q.

1 – Why you use tons of rules for every file and not something like ^(.*)\.txt$ ?

Mhh, I really don’t remember, maybe I have some text file I want to be accessible in the site.

2 – Why not just removing that text files?

I think that CVS import them on every update, so you have to remove the files many times.

]]>
http://dat.perdomani.net/2007/01/30/drupal-hide-install-text-files-using-rewrite-rules/feed/ 0