Cakephp subdomain in subdirectory not loading static files - cakephp

I have CakePHP in a subfolder public_html/cakedir, the folder being accessed from http://cakedir.mydomain.com. Everything seems to be working so far except that the static files are not being found, giving me 404 on the css files.
I'm unable to find anything useful on this issue, though it seems like something straightforward, so perhaps I'm just searching the wrong terms.
Thanks

This was a problem with the .htaccess file in webroot. Add RewriteBase /cakedir/app/webroot/ after RewriteEngine On and it'll work!

Related

ReactJS problem routing with deployment using apache2

I have been searching the web for solutions for my setup and no luck.
Note: All of these links work properly (www.mywebsite.com and www.mywebsite.com/subPage) when I run the app locally. When I deploy the app, the www.mywebsite.com works, but www.mywebsite.com/subPage does not work (404 NOT FOUND)
I have a website www.mywebsite.com that routes to xxx.xxx.xxx.xxx:80/mywebsite (This is on goDaddy)
This directory on my server that has the static files from the reactJS build is: /var/www/html/mywebsite
So basically the www.mywebsite.com -> /var/www/html/mywebsite
I am fairly certain I have a problem with my .htaccess (which is blank). I have tried many things from online, many different .htaccess files, but nothing I looked at covers my exact configuration.
I have tried putting the .htaccess file in /var/www/html
I have tried putting the .htaccess file in /var/www/html/mywebsite
I have also tried putting it in both. Nothing worked. My AllowOverride All is set properly and I turned on the rewrite module using instructions online and verified this.

CakePHP 2 path to webroot dir

How to create $this->Html->link(); to download file from Plugin webroot directory?
It's possible?
Why do you have to put the file in Plugin folder to be downloaded. This is not a good practice. Keep the file in webroot/file/name_of_folder
to get the path to webroot/ simply:
debug(WEBROOT);
Prefix with the plugin name
As mentioned in the docs, you can download plugin assets if the request url is prefixed with the plugin name (lower cased and underscored):
Simply prepend /plugin_name/ to the beginning of a request for an asset within that plugin, and it will work as if the asset were in your application’s webroot.
Note however that if the file is intended to be public it's a better idea for the asset to actually be in the webroot:
But keep in mind that handling static assets, such as images, Javascript and CSS files of plugins, through the Dispatcher is incredibly inefficient. It is strongly recommended to symlink them for production. For example like this:
ln -s app/Plugin/YourPlugin/webroot app/webroot/your_plugin
This would make it possible to access all files in a plugin's webroot directly without any rewrite or php logic being involved.

CodeIgniter - Project is main website

This may be a potentially really, really dumb question.
So my CI project is going to be our main company website. I have created it here:
www.example.com/CodeIgniter_2.1.3
How do I get my users redirected to that when they just visit www.example.com/ and have it stay www.example.com in the URL?
Is this a .htaccess file thing? Or do I need to move my folders up a level?
CodeIgniter's default behavior is to hide it's actual path. You should only need to copy the .htaccess to the document root, and modify the path to include CodeIgniter_2.1.3
i.e:
RewriteRule ^(.*)$ /CodeIgniter_2.1.3/index.php?/$1 [L,QSA]
So you have put the CI files in a directory called Codeigniter?

CakePHP installation on Production with subdomains

I have installled my Cakephp based website on my production site like following way
var/html/
app/
cake/
.htaccess etc
Its working perfectly untill I installed Blog. To make it work, I moved my content of blog folder to webroot, now my structure is
var/html/
app/
webroot/
blog/
cake/
.htaccess etc
This works thanks to those .htacess files
Now I am making a subdomain "m
"
ie http://www.m.example.com
My questions are...
Am I doing it right way?
Should I just move every subdomain etc to webroot?
Should I modify htaccess to acheive followwing structure
var/html/
app/
webroot/
cake/
.htaccess
blog/
m/
subdomain/
I would recommend separating them like this. The cake1.3 could be any name you want but the idea is that each framework should have its own descriptive folder.
This makes it much cleaner and is definitely necessary when you get into adding your projects to repositories like git. Each folder can then have its own .htaccess files and being separately configured in your apache config.
var/html/
cake1.3/
app/
webroot/
cake/
blog/

CakePHP: Set up a new project within another project

I've copied a homepage to the server, after a few problems with 1&1, if this matters, I've changed the .htaccess in the root, /app and /app/webroot directories. After
RewriteEngine on
I've included
RewriteBase /
to get it to work. However, beside the homepage itself, I've made an administration by adding a new CakePHP-project in the folder "Administration" which I've simply copied in the root-directory. Worked perfectly with XAMPP, but unfortunatly not with the 1&1-server. I've also tried to copy it in the app-folder, but visiting example.com/Administration will just give me an error, that says, the controller cannot be found.
Any ideas how I could access my administration?

Resources