简体   繁体   English

在 Laravel 公用文件夹中安装 WordPress

[英]Install WordPress inside Laravel public folder

I am trying to install WordPress into Laravel public folder.我正在尝试将 WordPress 安装到 Laravel 公用文件夹中。 I have completed the installation, but when I am trying to access the same with URL getting WordPress home page without any design.我已经完成了安装,但是当我尝试使用 URL 访问相同的内容时,得到 WordPress 主页没有任何设计。

Please find the .htaccess files of Laravel请找到 Laravel 的 .htaccess 文件

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    #Exclude url with quora
    RewriteCond $1 !^(quora)

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

WordPress .htaccess WordPress .htaccess

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

Dont put your wordpress folder inside laravel public's folder, it's a wrong way to do it and can cause problem.不要将 wordpress 文件夹放在 laravel 公众文件夹中,这是错误的做法,可能会导致问题。

I advise you instead to create 2 folders on the server root, one with laravel and one with wordpress.我建议您改为在服务器根目录上创建 2 个文件夹,一个使用 laravel,一个使用 wordpress。

Then to access to wordpress from laravel you have two choice,然后从 laravel 访问 wordpress 你有两个选择,

  1. use a subdomain (wordpress.exemple.com)使用子域(wordpress.exemple.com)
  2. create an alias (exemple.com/wordpress)创建别名(example.com/wordpress)

I think what your looking for is the alias so我想你要找的是别名所以

to create the alias, create a new apache conf but instead of using server property, use alias property要创建别名,请创建一个新的 apache conf,但不要使用服务器属性,而是使用别名属性

Alias /wordpress /var/www/wordpress/

<Directory "/var/www/wordpress/">
    //here your directory conf
</Directory>

enable the conf in apache, restart the server and now, on laravel when you go to the route /wordpress you're on wordpress. enable the conf in apache, restart the server and now, on laravel when you go to the route /wordpress you're on wordpress.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM