Central .htaccess file for multiple files? |
[eluser]mvdg27[/eluser]
Hi guys, Not exactly a codeigniter specific question, but maybe someone has experience with this ![]() I'm trying to achieve a way to have a central .htaccess file that can be used by multiple websites. Similar to how I for example re-use a 'sorry we are offline' image across websites. The latter I achieve through httpd.conf configuration as such: Code: Alias /offline.jpg /home/domains/foo/public_html/images/offline.jpg I figured to do the same for the htaccess file, but this statement doesn't work. I assume the .htaccess file is never called like this? Code: Alias /.htaccess /home/domains/foo/public_html/.htaccess Does anyone have experience on this matter? Any suggestions on how to have 1 central htaccess file being used by multiple sites? Thanks in advance! Michiel
[eluser]WanWizard[/eluser]
Have you tried the Include directive? I use it a lot in my httpd.conf (I don't like .htaccess files on production sites, to much file system access), don't know if you can use it in a .htaccess? Otherwise, store the orginal in a central location, and symlink to it?
[eluser]bretticus[/eluser]
You cannot alias .htaccess. nor any .ht* file. Aliases are for URLs and .ht* files are blocked for a good reason. They are not meant to be seen via public access. You want to symlink as suggested. Or, even better, stick this all in an Apache config and include it in each virtualhost if you have access to the Apache config files.
[eluser]mvdg27[/eluser]
Hi guys, Thanks for the replies. I understand the point of the ht* files being blocked. Since I have access to the httpd.conf file, I want to add my htaccess directives to this file. In doing so, I ran into some problems. I currently have this: Code: # alias to my central CMS (admin part) Now this works if I type www.mydomain.com/index.php, but if I use the domain withour index.php, or something like: www.mydomain.com/foo/bar I get: Code: Not Found I can tell that the rewrite rules are executed, since omitting '/cms' in the statement results in an error. Any ideas? Thanks in advance! |
Welcome Guest, Not a member yet? Register Sign In |