CakePHP application run without mod_rewrite activation on server


Some shared server can not provide to read/write .htaccess file for which cakephp application can not run properly on those server. here is the simple solution to overcome these situation. just follow the below steps to make it workable on any server.

To configure CakePHP *not* to use mod_rewrite and to use CakePHP pretty URLs, remove these .htaccess files:


   /.htaccess
   /app/.htaccess
   /app/webroot/.htaccess
 

Uncomment the App.baseUrl line from core file :

File location : /app/Config/core.php


   Configure::write('App.baseUrl', env('SCRIPT_NAME'));
 
Advertisements

Virtual Host configuration for windows operating system ( XAMPP SERVER )


Virtual Host configuration for windows operating system ( XAMPP SERVER ).

1. Open the file hosts from ( C:\Windows\System32\drivers\etc\hosts )

127.0.0.1   www.testurl.com

2. Then open the httpd-vhosts.conf for xampp server from (  C:\xampp\apache\conf\extra\httpd-vhosts.conf )

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
    DocumentRoot C:/xampp/htdocs/
    ServerName localhost
    ServerAdmin admin@localhost
</VirtualHost>

# This is the configuration for www.testurl.com
<VirtualHost *:80>
    DocumentRoot "C:\wamp\www\project_dir"
    ServerName www.testurl.com
    DirectoryIndex index.php
    <Directory C:/wamp/www/>
      Order Deny,Allow   
      Allow from all 
    </Directory>
</VirtualHost>