By artwork on
I have multi site drupal by softlink (ln -s)all my site to core dir say drupal6 and in this dir I edit .htaccess to redirect /node to 404 path (because I don't need this deafult /node path) with this command "Redirect 301 /node http://my-site-name.com/some-path". I have 2 questions.
1. how can I specified .htaccess for each site. where should I located it.
2. redirect didn't work the way I want it transfer me to http://my-site-name.com/some-path?q=node
Comments
htaccess
.htaccess is a set of instructions and rules for Apache. It is processed by the webserver before any information gets to Drupal.
In a multisite scenario, where you are sharing a common codebase, all sites will inherit the same .htaccess rules. You can write conditional instructions in .htaccess that test for the sitename, but it is not trivial.
If you have the typical setup
If you have the typical setup with rewrite enabled in apache, you can use
and then you won't need multiple .htaccess files. You can stick it after
Also the excellent global_redirect module takes care of the /node issue among other things if you're interested in avoiding duplicate content for SEO.
If you're really interested in maintaining different .htaccess files, robots.txt files (although there's a module for this), and other unique files in your webroot you may wish to look into this setup http://justinhileman.info/articles/a-more-secure-drupal-multisite-install.
I have to put rewrite rule in
I have to put rewrite rule in .htaccess ? and how can I have rewrite rules for each sites? can you give me an example. And what about my 2nd question anyone know ?
Thank you,
I have try your rewrite rule
I have try your rewrite rule and it work (this solve my second problem ) but I still confuse on how to apply rule for each site, so I dont need multiple .htaccess as you mentioned.
It depends how many rewrites
It depends how many rewrites and how complicated you need to get. For your /node problem, that's something you want to solve for all of your domains, so a general rule like that is a good solution.
If you want a rule specific to a certain site, you can do that with
which only applies the RewriteRule if the RewriteCond is true (i.e. if the host name matches "my-site-name\.com"). But you may not want to do an .htaccess rewrite for every single individual page. There are some tutorials out there how to write the conditions and the rules and the different variables you can use. You can match certain patterns so you don't need a rule for every single page.
You could also try the http://drupal.org/project/path_redirect module and then easily type in the different redirects and they'll be stored in the drupal database. This is easier to do, but performance may be worse than doing it in an .htaccess files.
Depends on the details of your situation.
Thanks from me as well. I've
Thanks from me as well. I've been looking all over for a while to an answer to this issue. Your post (minus one of the the double "RewriteRule") helped me greatly.
Thank you for your
Thank you for your discussion. The same problem happened to me. Your answer to solve it.
Thank you very much :)
Thank you very much :)