Monday, February 9, 2015

How to default my site to cakephp app

Hello,
I am starting with CakePHP 2.6 . I created the basic app Posts , and it is working fine when I type in the browser http://www.mysite.com/posts 
I want to redirect my default site to it: so if I type in the browser http://www.mysite.com  it redirects to http://www.mysite.com/posts
1.)
I have in /etc/apache2/sites-enabled/000-default
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/project/app/webroot
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/project/app/webroot>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


2.) I have in /var/www/project/app/webroot/.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

3.)
When I type in the browser http://www.mysite.com , error.log is updated with
Request URL: /
Stack Trace:
#0 /var/www/project/lib/Cake/View/View.php(961): include()
#1 /var/www/project/lib/Cake/View/View.php(923): View->_evaluate('/var/www/projec...', Array)
#2 /var/www/project/lib/Cake/View/View.php(473): View->_render('/var/www/projec...')
#3 /var/www/project/lib/Cake/Controller/Controller.php(959): View->render('home', NULL)
#4 /var/www/project/app/Controller/PagesController.php(68): Controller->render('home')
#5 [internal function]: PagesController->display('home')
#6 /var/www/project/lib/Cake/Controller/Controller.php(490): ReflectionMethod->invokeArgs(Object(PagesController), Array)
#7 /var/www/project/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction(Object(CakeRequest))
#8 /var/www/project/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(PagesController), Object(CakeRequest))
#9 /var/www/project/app/webroot/index.php(118): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#10 {main}


Thanks in advance for your help.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: