i follow this steps to configure my site on the host and it is work on this link
http://alashera.3owl.com/
/// steps ///
first i move all folders from myprojectfolder to public_html
second i remove myprojectfolder
third i move webroot folder from app to public_html and change path from index.php
/// one problem ///
but something wrong need to correct..when i clicked at any link to
enter to any class into controller it give me this error
i guess this error because i remove projectfolder (tet) but not sure....
one example :
before uploaded my project ..i used this links to enter to this classes in localhost like this
http://localhost/tet/galleries/
http://localhost/tet/articles/
after uploaded project and removed (tet) folder i use this links ..
http://alashera.3owl.com/galleries
http://alashera.3owl.com/articles
so why server cant see controllers classes..thanks
Looks like mod_rewrite is NOT working in your server.
Check if http://alashera.3owl.com/index.php/galleries (& http://alashera.3owl.com/index.php/articles) works. If that works, then I would suggest you check the following.
Is mod_rewrite enabled on the server?
Have you uploaded the relevant .htaccess or added appropriate rewrite rules to your virtual host configuration?
Is execution of .htaccess permitted in your server?
thanks for every one help me the correct answer with full steps is
move app, cake, plugins, vendors folder into your hosting root folder. It is user root folder on your hosting
delete .htaccess and index.php on cakephp root folder
move /app/webroot/. to /public_html folder
delete empty /app/webroot folder
edit /public_html/index.php to point to the ‘cake’ and ‘app’ directories. For example my public_html path for my domain is /home/myhost/public_html, so i point
ROOT to look at /home/myhost
APP_DIR to look at /home/myhost/app
CAKE_CORE_INCLUDE_PATH to look at /home/myhost/cake
edit this line on /public_html/index.php with your appropriate path
<?php
if (!defined('ROOT')) {
define('ROOT', DS.'home'.DS.'myhost');
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'app');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'myhost');
}
?>
7-
2. Alter 1 .htaccess file
For the fix to work, modify your app/webroot/ .htaccess file to read the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
8- change the home page from config/route
9-put database information from config/database
Related
I'm trying to deploy a site, but the server this need deploying on can't have an .htaccess file. On our test server we have the following as the .htaccess file:
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
How can we remove the need for the htaccess? It's fine to have the # in the URL if this is the only way?
I've found a way so posting the answer to help anyone with the same issue.
The index.html page was loading but all the assets, css and js files were 404ing, when building for production you can add a base-href which I added and pointed to the directory in the server.
ng build --prod --base-href /path/to/site/root/
This then worked, the only other thing I had to change was I was referencing some assets like this:
/assets/images/logo.png
Which I had to change to this for the base href to then work:
./assets/images/logo.png
Everything is working as I want it now without any .htaccess
The other thing to note is that without an .htaccess file the site will only work with the useHash enabled.
i have a url: www.example.co.za.
when i go to that url i can see my directory structure. This is my document root and needs to remain my document root so that i can access all underlying folders.
inside my document root i have the following folders. "auction","common".
auction contains "www" folder which is where my index.php file is.
My goal is to access example.co.za and then it must load "/auction/www". My url will then be "www.example.co.za/auction/www/index.php" but i dont want "/auction/www"in the url.
Can someone please help me with this. i suck at htaccess :(.
I dont want linked folders, other vhosts etc. I just need what i explained above.
Try:
RewriteEngine On
RewriteRule ^(index.php|)$ /auction/www/index.php [L]
This may now be the "definitive" answer or the "best way" to do it because .htaccess isn't my strongest area, but something like this should get you on the right path:
Be sure to put this in the .htaccess file in the root directory.
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ auction/www/$1 [L]
You can expand on this with alternative paths for a multi-app site, eg:
RewriteEngine on
RewriteBase /
RewriteRule ^auction/(.*)$ auction/www/$1
RewriteRule ^otherthing/(.*)$ otherthing/www/$1 [L]
etc.
So in the second example when you go to www.mysite.co.za/auction you'll be redirected to the content in auction/www, and if you go to www.mysite.co.za/otherthing you'll be redirected accordingly.
EDIT: added second example
i have build a webapp on Cakephp 2.3 .. on my locaLhost all urls were fine.. i can access my urls like this
http://localhost/Cakephp
but now when i have uploaded the site on server in root folder ... i cant access my url like this
http://www.myweb.com
instead it can accessible like this
http://www.myweb.com/index.php/login
what i think that might be a problem is the .htaccess file in my app/webroot folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
I think this kind of index.php is causing the problem ..as i dont know about .htaccess so dont know how to remove it.
How do I get index.php out of my urls?
So, it should be ok? You already have mod_rewrite?
If mod_rewrite is correctly loaded, .htaccess files are in place and index.php still appears in links then it is most probably problem with core.php framework configuration file.
Problem cause
In my case it was problem with App.baseUrl configuration option:
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
Solving problem
Here is how I fixed that problem (and few others with redirects) by commenting out following line from core.php:
// Configure::write('App.baseUrl', env('SCRIPT_NAME'));
Check the mod_rewrite module is installed or not? if not kindly enable it in httpd.conf file.
Find the following line and remove # (means uncomment) in front of it.
LoadModule rewrite_module modules/mod_rewrite.so
Also don't forget to restart apache http service using following command:
service httpd restart
Following are the steps to edit http.conf file from CPanel:
Log in to WHM/cPanel as the root user.
Open the "Service Configuration" section.
Open the "Apache Configuration" section.
Click "Global Configuration" to access the httpd.conf's settings, as displayed through cPanel.
Make your desired changes, then click the "Save" button. This saves the changes and then reboots Apache so that the changes are applied.
Read more: http://www.ehow.com/how_8696084_edit-httpdconf-cpanel.html#ixzz2YRDEgOMT
On IIS Server Read this link to enable mod_rewrite
on ubuntu,
sudo a2enmod rewrite
sudo systemctl restart apache2
I seriously can't understand what is going on here. I just uploaded my web app from localhost to new domain-name on Windows IIS Server. When I try to access the web app, CSS files and images are not loaded and I get the following error:
"CssController could not be found."
I don't understand why it is doing this.
Although I've written code like this in my default.ctp:
echo $this->html->css('generic');
CSS files are placed in:
app\webroot\css
I have searched on Google and have tried everything, I even uncommented the line:
Configure::write('App.baseUrl',env('SCRIPT_NAME')); in core.php
But I still cannot get this to work. Please help me to resolve this issue.
Double check that you have all the .htaccess files in place.
Also making sure /app/webroot/ has its .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Your request is trying to get the css file from /css/ but i'm thinking you don't have the proper .htaccess files in place to route it to the webroot and not to a controller!
also check if mod_rewrite is enabled
Edit: and then I saw the IIS part, you need some IIS equivalent to mod_rewrite
In this article you find all the information required for successfully run CakePHP web applications under Microsoft IIS web server: http://bakery.cakephp.org/articles/filippo.toso/2008/01/29/cakephp-on-iis
Here is a related question about getting cake to work on IIS: CakePHP 2.2.2 not working on Windows IIS7
I have working domain.kz with cakephp (Cpanel hosting)
www/app
www/cake
www/index.php
how can i setup admin.domain.kz to (app2)
www/app
www/app2
www/cake
www/index.php
The way you want it - will be very difficult; you'll have to change several file/folder paths in several places. Instead, why don't you try to create an admin folder where you've the full cakephp application for admin.
So the resulting folder structure would be like this:
(domain.kz)
www/app
www/cake
www/index.php
(admin.domain.kz)
www/admin/app
www/admin/cake
www/admin/index.php
Then you'll have to point your subdomain (admin.domain.kz) to /www/admin.
Now assuming that you've configured your domain and subdomain correctly, if you try to browse your domain, it'll work with no issues but if you try to access your subdomain, it'll give you a 500 error. DON'T WORRY. It is expected.
The primary .htaccess file is forcing all requests served by primary webroot (www/app/webroot) folder. You'll have to change your primary .htaccess file (www/.htaccess) like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin\.domain\.kz$ [NC]
RewriteRule ^ - [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Notice that, I've added two lines which tells that if you're trying to access your subdomain, stop rewriting; otherwise rewrite as usual. Cheers!!!
If the cake apps are totally separate but share a cake library then the following might work:
You could use cPanel's 'Addon Domain' feature, once the DNS has been set up for admin.domain.kz. Instructions can be found here.
Set the document root of the addon domain to the www/app2 folder.
Then just make sure that CAKE_CORE_INCLUDE_PATH in www/app2/webroot/index.php points to ../../../cake