use subdirectory as other purpose in laravel - php

I have installed laravel in my root of domain, its working fine. However
I want use one sub directory for other purpose like install admin panel in it. For example I have installed laravel in example.com Now I want install other core PHP admin panel in new sub directory called adminpanel. its like this example.com/adminpanel/
but when I try to access it, its giving me error called page does not redirect correctly. I have read somewhere that I can achieve it if I modify my .httaccess file but I have not much knowlede of it. Let me know if someone can help me for same.
Thanks!

Better option is creating an subdomain for the admin dashboard. Login into your cPanel and create a sub domain adminpanel.example.com set the path to your new folder.
Non cPanal
If you don't have cPanel, You should create vhosts for your subdomain in server config (apache/nginx).

Related

how to install laravel inside an addon domain

I have an addon domain like this :
/public_html/mysite
Site is available from the following address:
www.mysite.com
now I want to install laravel on this addon site.
I've copied all folders insdie mysite directory :
but when I enter www.mysite.com on my browser it shows content of my laravel project :
solved:
How to install laravel inside an addon domain
There are different ways you can install laravel inside an addon domain. Here is one of the easiest ways to do it.
Go to your CPanel and open Softaculous Apps Installer.
Look for Laravel Installer and open it. Carefully select the addon domain where you want to install Laravel.
Click Install. If there was no previous install then it would take 3-4 seconds.
Now go to the File Manager and open that specific domain folder. You will see All the laravel files there.
Now if you have an existing project that you want to upload on this domain simply make a zip file of your project and upload & extract inside this domain folder.
ONE LAST THING
When you install Laravel using Softaculous Apps Installer you get a redirect from domain to /public. To resolve this open index.php file (Not the one inside the public folder, one that is outside). Remove all the code from it and just paste the code given below.
<?php
header('Location: public/');
?>
And that is it. This should work for you.
Is it a shared hosting you're using if yes then :
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally)
Now in
then modify your index.php and your bootstrap.php and it will work just fine

Yii2 - URL for basic application template

I have just installed the Yii2 Basic Application Template using Composer.
This is now accessible on my localhost machine at the following URL:
http://localhost/basic/web
In Yii 1.1, it was possible to access a web application by simply going to :
http://localhost/basic
Having done some reading, it appears the only way to achieve the above is to create a new Apache vhosts entry. Whilst this is fine for one or two sites, if like myself you are working on new sites all the time, it is a bid tedious to have to set up vhosts for each and every site.
I have tried creating a .htaccess file to redirect all requests to web/index.php but this does not work. Is this at all possible to do in Yii2?
Move all the content in the /basic folder to eg. /basic-yii instead. Then take the /basic/web folder (now /basic-yii/web) and put all it's content into the /basic folder. Then adjust the paths for the require() calls in /basic/index.php to correctly point to autoload.php, Yii.php and web.php.

Install laravel in a subfolder via ftp

I'm working with a server that I can only use FTP, so I have my laravel project in a folder inside www named 'laravel', I want to see my project by clicking domain.com/laravel, inside this www folder I have others folders with others projects I don't think that I can use the root to upload my laravel project like I saw in many tutorials.
Now If I visit domain.com/laravel i only see a list of directories ,Is possible to view my project working at /laravel ??
Thanks!
You would either need to add a custom mod rewrite config or configure your apache virtual host directory to be laravel/public

Best way to organize a website root

I have made a website (WP based) and put every stuff inside the /site folder.
I did that, thinking of creating "custom" systems, and putting each one inside a folder, so for example: /promo would go to something else than the website...
But, I have tried with both .htaccess redirect and PHP location redirect, and when I try to "share" the website, without it's /site folder included, Facebook doesen't detect's the site meta...
Also, is it a problem for google, to use redirect's when accessing the website without the /site WP home folder? I mean, a guy comming from a www.onesite.com would have it's "referer" header as onesite, or mysite?
Thanks
I feel like you're creating your own problems. Just put WordPress in document root and don't bother with rewriting to a subdirectory. WordPress won't delete any custom files or folders when updating.
If you have some custom part that you want to reach through http://www.example.com/promo. Put it in the promo folder under the document root.
If want to reach the custom part through http://promo.example.com, just create new virtual host.

How do I get CakePHP configured so it shows up correctly in my browser?

I am a cakephp newbie and I had trouble to view the files under the view folder through browser.
I used cakephp console to bake model, controller and views. (ex: Invoices_controller.php for controller, invoice.php for model and a invoices folders under views folder). According to the tutorial I read, I can access the invoice view by typing http://localhost/myProject/invoices
(there is no index.php inside the invoices folder..but the tutorial shows it still can display a page. no idea how they did it)
The path for my invoices is myProject/views/invoices and there add.ctp, index.ctp, edit.ctp files inside the invoices folder.
The browser showed the file is not found when I typed http://localhost/myProject/invoices
You have some lack in your knowledge about how the webserver handling a request when cakephp is installed. Assume that we use apache.
In cake's folder structure you can see .htaccess files in the root, app and webroot directories what have url rewrite rules in them. At the end a normal request to a cakephp site will be transformed to a http://site.url.root/app/webroot/index.php?url=original.url
In nutshell to understand it in your point of view:
That index.php call the required php files and at least a cakephp app object is built up in the memory with the required models and methods. Then the app object let say start and calls its methods (model, controller and view methods) and at the end it gives back a result to apache what serves it to you.
Therefore the original url path is a "non existent" virtual url.
If you enter http://localhost/myProject/ do you get a cake intro page? If so does it highlight any problems?
It sounds to me as if you do not have Apache set up properly. I don't know what OS you're using, but it might be worth checking this link, written for Ubuntu, to make sure all is well: http://leoponton.blogspot.com/2010/05/getting-cakephp-up-and-running-on.html
I fixed the same problem.
if you are using windows 7 os, wamp server, cakephp 2.2.3. then
goto apache -> http.conf -> open -> search for mod_rewrite -> uncomment the line LoadModule rewrite_module modules/mod_rewrite.so
Now restart your server, now it should work fine.
Jerry, I think the issue is this. You have put the CakePHP folder in the root of localhost. I would propose that you create a virtual host pointing the myProject so the url becomes:
http://myProject/accounting
This may solve your problem. Be sure rewrite module is on. Also, when you point the virtual host to myProject, it should be the APP folder of the cakephp. If you want to run multiple projects off the same core, you can set them up like so:
/var/www/cake
/var/www/html/myProject
/var/www/html/myProject2
The /var/www/cake directory is where you drop the cake core. Under this directory you will have cake, app, plugins, vendors, etc. the myProject(2) directories will be the contents of the app directory.
Now, to get this to work, you need to go to /var/www/html/myProject/webroot/index.php and edit it to point to the cake directory in /var/www/cake. This will then load the core when rewrite points to index.php in webroot. You should be good to go!

Categories