39693

How to install wordpress in laravel public folder

<h3>Question</h3>

i also follow this link but this is not my solution - laravel and wordpress on the same domain(laravel in subfolder)
i want to add wordpress in my laravel site.
so i install all wordpress in my laravel's public folders. here i create one folder "blog" and in this folder i install my wordpress site.

but my problem is when i run my wordpress site like that localhost:8000/blog it work fine

But when i am try to oprn another link then laravel redirect me 404 page not found.

so how to run wordpress in laravel if make any changes in any file so please any one help me.

my laravel public folder's .htaccess look like that

<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


<h3>Answer1:</h3>

To run wordpress as subdirectory, you must change the .htaccess file inside worpress directory like below:

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule>

Follow this guide for more information https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory


<h3>Answer2:</h3>

Well that quite simple if you have a laravel application such as laravel. What you have to do is just:

<ol><li>

download wordpress form wordpress.org

</li> <li>

rename that downloaded wordpress folder to any name such as blog

</li> <li>

put that blog folder into a public directory of laravel

</li> <li>

put database credential of wordpress blog into wp-config.php

</li> <li>

as well as put laravel db credential in .env

</li> <li>

make change in .htaccess of laravel

<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} http://localhost/laravel/public/$ RewriteCond %{REQUEST_URI} !^/blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /blog/$1 RewriteCond %{HTTP_HOST} http://localhost/laravel/public/$ RewriteRule ^(/)?$ blog/index.php [L] </IfModule> </li> <li>

You can easily access your blog as http://localhost/laravel/public/blog

</li> <li>

It will start wordpress blog

</li> </ol>

来源:https://stackoverflow.com/questions/44347249/how-to-install-wordpress-in-laravel-public-folder

Recommend

  • Android org.webrtc.VideoRenderer.I420Frame arrays to PreviewCallback.onPreviewFrame byte[]
  • How do you represent MS-DTYP `DATETIME` in Java 8 Instant?
  • Error with Binding in Caliburn.Micro, how to solve?
  • get value of checkbox in symfony
  • ImageView in CardView not show radius on Android 4.3
  • Generate a PDF with background image without margin
  • Why OpenFST does not seem to have 'run' or 'accept' or 'transduce' com
  • how to dynamically bind a directive in angularjs?
  • Trying to pass error message from Controller to View without page reload (MVC)
  • cannot allocate memory error
  • 'NoneType' object has no attribute 'owner' when trying to access relationship
  • Many to Many Invalid Object name
  • select multiple elements with group by in spark.sql
  • How to add tag during runtime in C#
  • Move UIView per UIBezierPath [closed]
  • What's the difference between using RDFS/OWL and XML?
  • Problems with special characters in php soap client
  • Unsupported ciphersuite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  • Swift manually rotate view controller
  • python selenium scraping tbody
  • readmore button or show/hide for php
  • Create an average of multiple excel chart without the data source
  • Can a PHP script be scheduled to run at a specific time or after a specific amount of time has expir
  • how to run ejabberd with Erlang on Heroku?
  • How to use Streams api peek() function and make it work?
  • `$http:badreq Bad Request Configuration` - from angular post method, what is wrong here?
  • What is the best way to cache and reuse immutable singleton objects in Java?
  • Update cell query for Excel ADO from Delphi
  • How to get rgb from transparent pixel in js
  • How to use FirstOrDefault inside Include
  • PHP Permalinks.. how to change?
  • media foundation H264 decoder not working properly
  • Running R's aov() mixed effects model from Python using rpy2
  • Access to a Matlab gui from the web
  • ReferenceError: TextEncoder is not defined