Running wordpress with one of php frameworks - php

Is it possible to run wordpress as a sub url of a website (for example /blog) as the other urls are under control of a framework (like laravel or codeigniter) ? And if yes how?
PS: I don't want to use a different subdomain.

Yes , You can use , Simple put folder named as blog in root and install wordpress in that folder , if you are using laravel then you must create folder inside public folder and then install wordpress in that folder
for example
this is my domain at which i am using wordpress
https://www.coodingdessign.com/
this is another url at which core php are running
https://www.coodingdessign.com/php-editor/

Related

Can I install a Laravel project in a subdirectory of my server?

I have a website that was built with just good vanilla PHP, no frameworks, etc. I am now needed to add a blog to this website and I am wanting to use Laravel / Statamtic to do so. My question is this:
Can I install a Laravel project in a subdirectory of my server? For example, www.mywebsite.com/blog/. Ideally, everything in the blog directory would operate with my Laravel code. Everything outside of the blog directory would just continue to work as is. Is this possible?
And if it is possible, is there something special I need to do in my Ngnix config file?
All you would have to do is take the contents in the /public folder and put it in the desired subdirectory, so "yourwebsite/blog". Then move the contents from the root laravel folder to outside the root folder on the server, so basically everything that is left in the project after you remove public would then go into say "/var/www/" if your root folder is "/var/www/html". After that simply update the path to the autoloader and app.php in the index.php file, which was previously in your public folder but is now in your sub directory. Keep in mind if you do this all routes in the laravel app will have to have the subdirectory as part of any relative url, probably simple to solve this with a group.
If you are simply looking to do a blog and already know PHP why not pick up wordpress and do a basic template for yourself? It's simple to pick up, a weekend maybe. If you consider it check out VCCW as a development environment.

Multiple projects using Laravel

I recently installed Laravel and created a project on my webserver. I had to create a symbolic link for public_html to the public folder inside the Laravel folder. I realized that if I wanted to create another project, how would I do that?
I used to use CodeIgniter and setup was just placing it in a folder and typing the www.url.com/project1
www.url.com/project2
to access the different projects
Basically each laravel installation comes with a public folder. The public folder contains the index.php file, which is the entry point for all requests entering your application. This directory also houses your assets such as images, JavaScript, and CSS.
If you want to put laravel on sub directory, you will have access to sub directory's public folder. For example, www.url.com/project2/public
But a better solution of this is to create a sub domain and point the directory path to public_html/project2/public so you will have a working laravel on URL like this, www.project2.url.com
This is shared hosting solution and works for all laravel versions.

INSTALLING WORDPRESS AS SUBDOMAIN,(blog.domain.com), while laravel 5 is main site. (www.domain.com)

I just created a fully functional laravel 5 application, but the pain of building the blog from scratch for the client is too much to bear. Is there any way I can create a subdomain for the site ( blog.domain.com ) and install wordpress as the blog instead ? while laravel runs normally on the domain
As both are separate application (WordPress and Laravel) and you want to host them on different scope (main domain and subdomain), there shouldn't be any problem.
Just create your subdomain (blog) and point to your WordPress installation directory and point your main domain (www) to your Laravel installation.

Determine if Joomla is in a subdirectory

Joomla 3.2.3
Hi all, I am trying to develop a plugin for Joomla (just for myself) and I have run into a problem.
Basically, the plugin searches for the URL linking to the local copy of bootstrap.min.css which is:
/media/jui/css/bootstrap.min.css
This is then replaced by a CDN version of the Bootstrap CSS.
Everything works fine when the website is located in the root of the domain but if the website is in a subdirectory then the link changes to:
/subdirectory/media/jui/css/bootstrap.min.css
And the plugin stops loading the CDN version.
Is there a PHP based way to determine if the website is being hosted in a subdirectory?
Thanks
the constant JPATH_BASE gives the base directory Joomla is installed in:
http://docs.joomla.org/How_to_find_your_absolute_path
This points to the directory the index.php is located in. Which parses all requests to the joomla installation.
I have sorted this by using
JURI::base(true);
As outlined at http://docs.joomla.org/JURI/base

PHP - First Time Installation of Laravel 4 on VPS

Hey so I am completely new to Laravel 4 and have some basic questions regarding my first time installation that I was unable to find answers to anywhere else on-line. I am planning of hosting a standard website with a fully dynamic web back end and a RESTful API using the framework. I have been following this installation guide and am essentially at the part where I type laravel new projectDir and it creates a new instance of Laravel in the provided directory.
Now my main public directory is public_html, is it recommended to install Laravel 4 directly into that directory. So is something like laravel new public_html recommended? I have found many other questions here that seem to suggest that this is not the safest solution. Should I make a separate directory inside public_html, is it necessary for what I am planning on doing with laravel?
Also, I would like to keep my URL's as neat as possible and would like them primarily to be www.domain-name.com/pagename for the website. Will creating a directory inside of public_html disable me from doing so?
Lastly I had some issues with routing my URL's when I tried to install a different framework on this server. Are there any server/Apache settings that would impact how URL's are routed with laravel that I should disable/enable before I install Laravel into a directory?
you would not put the base Laravel folder in public_html.
In a Laravel directory structure, which gets created when you do the laravel new command, there is a directory called public. This is what you map your web root to. So on my vps, I have a folder called /var/site/mywebapp which was created by the command:
laravel new mywebapp
In nginx (which I much prefer over Apache), I map my server root to:
/var/sites/mywebapp/public
In the public folder is an index.php that Laravel uses to run your whole app/site. The rest of the framework is outside of the web root and is not accessible by HTTP.
As for your URL issues, consult the documentation for how to properly configure your mod_rewrite (assuming Apache).
Also, Dayle Rees, a prominent member of the Laravel community (and core contributor), has a github of sample web server configs here:
https://github.com/daylerees/laravel-website-configs
When you install Laravel it will create a public folder, along with app, bootstrap and vendor folders.
The public folder is essentially your public_html folder where you want your host/apache to point to when viewing the root of your website. So mydomain.com should land directly within the public folder.
You can rename the public folder to public_html just be sure to also update bootstrap/paths.php paths value
'public' => __DIR__.'/../public',
// change to
'public' => __DIR__.'/../public_html',
Laravel will create a .htaccess file for you, which will grab URLs and redirect them to public/index.php which will process Laravel accordingly.
So to answer the question, you install Laravel one folder back from public_html and then you can rename public to public_html if your host requires.

Categories