My hosting company points my "primary" domain title towards the root www folder. The net files for your site are situated within the "www/application/webroot" folder. I presently possess the site ready to go while using following within the htaccess file:
RewriteBase / RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L]
I am attempting to begin a dev site for the similar site. I designed a folder named "dev" within the www folder. So, the net files with this folder have been in: "www/dev/application/webroot" I've got a sub-domain pointing towards the dev folder. After I make use of the same htaccess as above within the dev folder, it does not work because (In my opinion) it's getting the configurations in the root www folder. Once the page loads, it simply pops up blank. How do you setup my htaccess files to permit both sites?
Thanks ahead of time for just about any help! I am clearly a newcomer only at that stuff.
Try adding dev/ towards the pathways in lines 3 and 4 for your dev .htaccess.
Perhaps you should take away the "RewriteBase /" line within the .htaccess inside your dev folder?
So we'll attempt to clean the items :-)
Stay away from .htaccess. All of the configurations inside a .htaccess inside a directory /foo/bar could be occur apache configuration like a Directory setting (.haccess is helpfull should you provide limited access on apache conf, should you own the server avoid using it).
You'll be able to access your sites with named based virtualhosts. Verify you've this method:
If you have it nice things can begin. This is your virtualhost for the first application:
<VirtualHost *:80> ServerName app ServerAlias www.app.somwhere.com ServerAlias app.somwhere.com DocumentRoot /www/app/webroot <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /www/app/webroot> Options Indexes FollowSymLinks # this prevent.htaccess reading, remove if you want .htaccess AllowOverride None # allow web access Order allow,deny allow from all </Directory> </VirtualHost>
Most apache configurations could be define here. Just for your first application. Apache assists this configuration for those demands accomplished for the website title 'app', or 'www.application.somwhere.com', or 'app.somwhere.com'. You are able to define lots of alias(ServerAlias)., and just one title (ServerName).
Then should you use your browser and kind http://app/ your browser will not discover the server, so place it inside your /etc/hosts. This is exactly what every people attempting to access your application must have within the hosts file until you receive a real DNS (presuming your first application is application.somwhere.com and also the second foo.somwhere.com and 184.108.40.206is your exterior IP):
127.0.0.1 app.somwhere.com app foo foo.somewhere.com 220.127.116.11 app.somwhere.com app foo foo.somewhere.com
And today let us add another virtualhost for the second application:
<VirtualHost *:80> ServerName foo ServerAlias www.foo.somwhere.com ServerAlias foo.somwhere.com DocumentRoot /www/foo/webroot <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /www/foo/webroot> Options Indexes FollowSymLinks # this prevent.htaccess reading, remove if you want .htaccess AllowOverride None # allow web access Order allow,deny allow from all </Directory> </VirtualHost>
And etc. Be sure to restart your apache. No rewrite rule. nice virtualhosts may be the first step of the nice configuration, you'll have the ability to define rules, directory or location specific things per title used. Even php configuration could be set per virtualhost with php_value rather than a worldwide shared one on php.ini.
to obtain the listing of your virtualhosts, you'll notice that the first may be the 'default' one, if apache does'nt comprehend the title from the asked for site it'll serve this default one (which means you could ad a particular virtualhost on the top to deal with theses cases).