Laravel 5.7和Wordpress 5.1作为前端

时间:2019-03-07 16:54:11

标签: wordpress laravel .htaccess

Laravel 5.7和Wordpress 5.1作为前端

我需要它们在同一个域中,并且WP应该作为简单的内容更新解决方案的前端。这意味着所有WP文件都将位于“ public_html”文件夹中,而Laravel则位于“ public_html / app /”中。两者都将通过cPanel完成MySQL数据库。 WP索引文件将为“ public_html / index.php”,Laravel将为“ public_html / app / laravelindex.php”。两者都将在其自己的文件夹中使用“ .htaccess”文件,例如WP“ public_html / .htaccess”和Laravel“ public_html / app / .htaccess”。

Laravel是否也可以使用WP“ .htaccess”文件,如果可以,请复制整个代码。

否则,请复制Laravels“ .htaccess”文件的整个代码。

下面是当前“ public_html / .htaccess”代码供您修改。

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

    RewriteEngine On

    # 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>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

1 个答案:

答案 0 :(得分:0)

我会看一个100%的子域,我为此浪费了很多时间。

如果您使用的是Forge,请为应用(user.domain.com)创建一个子域,然后在(domain.com)上安装Wordpress。

请记住,不要对Wordpress和Laravel使用相同的数据库,用户名和密码。由于安全原因,这将是不明智的。