issues with document root and rewrite urls
Hi, I have a setup where I want the document root to set to the main directory where my application is residing. Currently, the path to my directory is something like this: /var/www/html/dev.mydomain.com/aaa/code_project/ app/ cake/ index.php plugins README vendors Now the point where all this started was when I was writing URLs for my navigation tabs. For eg, to access the tab 'inbox', I wanted to write the URL in the file to be was '/inbox/'. But when I did that, the URL actually pointed to http://dev.mydomain.com/inbox/. I guess that means my document root is not pointing to the code_project directory but to the dev.mydomain.com directory. I wrote the following line in the .htaccess file, IfModule mod_rewrite.c RewriteEngine on RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] # this line was added by me #DocumentRoot /var/www/html/dev.mydomain.com/aaa/bbb/code_project/app/webroot/ /IfModule But, when I tried accessing the url, it gave me a 500 error. Can anybody help me gaining knowledge of how exactly this thing works and how to set it all up? Thanking you guys in advance and looking forward to some replies. regards, Rishab -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: issues with document root and rewrite urls
On Mon, Mar 28, 2011 at 2:02 PM, Rishab Jain jairis...@gmail.com wrote: Hi, I have a setup where I want the document root to set to the main directory where my application is residing. Currently, the path to my directory is something like this: /var/www/html/dev.mydomain.com/aaa/code_project/ app/ cake/ index.php plugins README vendors Now the point where all this started was when I was writing URLs for my navigation tabs. For eg, to access the tab 'inbox', I wanted to write the URL in the file to be was '/inbox/'. But when I did that, the URL actually pointed to http://dev.mydomain.com/inbox/. I guess that means my document root is not pointing to the code_project directory but to the dev.mydomain.com directory. That looks correct. Maybe you typed the wrong thing? These are equivalent: http://dev.mydomain.com/inbox/ /inbox/ The only difference is that one has the full domain information. I wrote the following line in the .htaccess file, IfModule mod_rewrite.c RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] # this line was added by me #DocumentRoot /var/www/html/dev.mydomain.com/aaa/bbb/code_project/app/webroot/ /IfModule But, when I tried accessing the url, it gave me a 500 error. Can anybody help me gaining knowledge of how exactly this thing works and how to set it all up? You're on the right track, but DocumentRoot should not be placed there. In fact, it must not appear anywhere inside an htaccess file. It belongs in the main httpd.conf or that of a virtual host. If you have the ability to edit those, do so. And also disable htaccess there as it will speed up requests moderately. -- snip -- DocumentRoot /path/to/site/app/webroot Directory /path/to/site/app/webroot Options FollowSymLinks # disable .htaccess AllowOverride None Order allow,deny Allow from all DirectoryIndex index.php index.html # copied from app/webroot/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule /Directory -- snip -- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: issues with document root and rewrite urls
Thanks. :-) Rishab Sent from BlackBerry® on Airtel -Original Message- From: cricket zijn.digi...@gmail.com Sender: cake-php@googlegroups.com Date: Mon, 28 Mar 2011 14:23:20 To: cake-php@googlegroups.com Reply-To: cake-php@googlegroups.com Subject: Re: issues with document root and rewrite urls On Mon, Mar 28, 2011 at 2:02 PM, Rishab Jain jairis...@gmail.com wrote: Hi, I have a setup where I want the document root to set to the main directory where my application is residing. Currently, the path to my directory is something like this: /var/www/html/dev.mydomain.com/aaa/code_project/ app/ cake/ index.php plugins README vendors Now the point where all this started was when I was writing URLs for my navigation tabs. For eg, to access the tab 'inbox', I wanted to write the URL in the file to be was '/inbox/'. But when I did that, the URL actually pointed to http://dev.mydomain.com/inbox/. I guess that means my document root is not pointing to the code_project directory but to the dev.mydomain.com directory. That looks correct. Maybe you typed the wrong thing? These are equivalent: http://dev.mydomain.com/inbox/ /inbox/ The only difference is that one has the full domain information. I wrote the following line in the .htaccess file, IfModule mod_rewrite.c RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] # this line was added by me #DocumentRoot /var/www/html/dev.mydomain.com/aaa/bbb/code_project/app/webroot/ /IfModule But, when I tried accessing the url, it gave me a 500 error. Can anybody help me gaining knowledge of how exactly this thing works and how to set it all up? You're on the right track, but DocumentRoot should not be placed there. In fact, it must not appear anywhere inside an htaccess file. It belongs in the main httpd.conf or that of a virtual host. If you have the ability to edit those, do so. And also disable htaccess there as it will speed up requests moderately. -- snip -- DocumentRoot /path/to/site/app/webroot Directory /path/to/site/app/webroot Options FollowSymLinks # disable .htaccess AllowOverride None Order allow,deny Allow from all DirectoryIndex index.php index.html # copied from app/webroot/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule /Directory -- snip -- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php