can laravel & wordpress play together? - php

this is my problem with laravel & WordPress:
i need to put a blog inside laravel installation.
i want to use WordPress but i can't figure it out.
i put the WP files inside public/blog/ but i can't install it.
the redirect is the error part.
i need to say that to Apache:
if( $url = public/blog/* ){
ignore normal laravel routing system & redirect to WordPress inside (public/blog/*)
}

To keep your laravel .htaccess clean, just copy the .htaccess from any active wordpress project using clean urls (or look in wordpress doc) and copy it to your clean wordpress folder in public/bloc (it's nearly the same as for the laravel).
Without the .htaccess in your blog folder the laravel "public/.htaccess" redirect all not specific and existing files url to "public/index.php"

to solve this I just put the laravel folder next to the wpBlog folder.
& used namespaces to redirect the user to each based on the used url.
SO:-
blog.website.com : will redirect to the wp blog
site.website.com : will redirect to the laravel website

Related

How to stop Laravel directory errors

Is there a way in laravel to make directory accesable without Laravel having to get involved?
I recently ported a Wordpress website for my brother into Laravel (which I am new to) and all of the image paths are hard coded in the body of the blog article.
The issue I am having is that the url it need to read the image at is:
http://www.theunlikelytraveller.co.uk/wp-content/uploads/2015/11/DSC_0728.jpg
but laravel doesn't like that.
Here's the article: http://www.theunlikelytraveller.co.uk/posts/a-return-to-the-beautiful-balkans
Can anyone help?
If you want to force Laravel to ignore wp-content directory, for example, you can edit .htaccess file inside a public directory:
RewriteRule ^wp-content - [L,NC]
This line should be added before other rules.

Wordpress alongside Codeignitier?

I have ci installed in root and wordpress inside wordpress directory.
I already allowed wordpress to use root by setting site url and main .htaccess to rewrite wordpress directory, but because ci is inside root i have url conflict between ci and wordpress..
You know that ci using pretty links, so when i try to run this for example:
example.com/ci_class/ci_function
It's redirects me to wordpress template with message
Not Found
This happens probably because i included wordpress wp-load.php inside index.php of codeignitier...
What i can to do?
I want to use wordpress functions inside ci, but i also want that ci url works fine...

Wordpress themes not generating a proper homepage on a server folder

I am using a wordpress theme which I have modified a bit, based on the "Revera" Wordpress theme.
I have used it on other sites and it has worded fine. However, I have always installed it in the root of the domain. This time I have installed it on http://www.gas-sense.co.uk/blog
It isn't generating the usual homepage layout ( see http://www.georgeedwards.co )
Just wondering if the themes are typically setup to trigger the homepage layout? and if that is defined in a particular section of the php ?
The root folder is not a problem, you probably didn't set up the site url correctly, read the docs bellow
https://codex.wordpress.org/Changing_The_Site_URL

Install script on non wordpress subdirectory folder

Im trying to install a script "moodle" in a subdirectory of my wordpress website but if I keep it in first level folder i get the wordpress 404 page not available or if I go deeper "2 level folders" it only show me my blog post!
however the url is changing to moodle/install.php !
How can I tell wordpress to ignore that specific subdirectory and everything inside it? i did search and tried some of the .htaccess hits but non actually worked!

wordpress integration with codeigniter base functions conflict

I have developed the CRM based web application what i need to do is to integrate the wordpres with my CI first i have the problem when i include the main WP file
require('./wp-blog-header.php');
in my one of the CI view file the error i was getting that function site_url() conflicts this function is the base function of both WP and CI ,although i found a solution to include the WP file in the main index.php file of CI but there is uncertainity too that after this the session library of CI stops working is.
How to show the posts of WP in the footer of my CRM?
When using include or require in my CodeIgniter views I make sure the files I am linking to are outside of the CodeIgniter application folder as I had trouble using files there because of some permission problems. My solution was to just keep a folder in my web directory. You also cannot use base_url or site_url CodeIgniter functions here since you want to get the server path not the web address of the file. So you can use the php variable $_SERVER['DOCUMENT_ROOT'] which will return the root of your web directory.
It might look something like this:
require($_SERVER['DOCUMENT_ROOT'].'wp-blog-header.php');
Which would work if wp-blog-header.php was in your web root directory.

Categories