WordPress的.htaccess代理奇怪 [英] Wordpress .htaccess acting weird

查看:206
本文介绍了WordPress的.htaccess代理奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WP Local中创建了一个WP站点,只是在测试部署过程.我使用WP Local本身将其导出,并上传了 app/public 文件夹,其中包含wp-admin,wp-content,wp-includes及其所有文件.

I created a WP site in WP Local and was just testing the deployment process. I exported it using WP Local itself and uploaded the app/public folder which contain the wp-admin, wp-content, wp-includes and all of its files.

为数据库连接配置wp-config,手动设置我的siteurl&主页以匹配域(atm,它是一个子域,所以我用这个).通过cloudflare也是SSL,所以我使用https://作为前缀.

Configure wp-config for the db connection, manually set my siteurl & home to match the domain (atm, its a subdomain so I use this one). It's also SSL through cloudflare so I'm using https:// as prefix.

我进入管理面板,设置-常规,检查了家庭和站点的URL,然后单击保存"以确保可以缓存.然后我进入设置-永久链接并保存在那里.

I went into admin panel, settings - general and checked the URL for home and site and clicked save just to be certain for cache. Then I went settings - permanlinks and saved all there.

结果->主页有效,其他人不起作用(wp-admin可以),所以我认为我的mod重写不起作用.

Result -> Homepage works, others don't (wp-admin does) so I thought my mod rewrite was not working.

Mod重写模块已激活,这是我的apache conf:

Mod rewrite module is activated and these are my apache conf:

<VirtualHost *:80>
    ServerAdmin myemail@test.be
    ServerName subdomain.domain.be
    DocumentRoot /var/www/wp-root-path

    <Directory /var/www/wp-root-path>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>

    ErrorLog ${APACHE_LOG_DIR}/subdomain.domain.be.error.log
    CustomLog ${APACHE_LOG_DIR}/subdomain.domain.be.access.log combined
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin myemail@test.be
    ServerName subdomain.domain.be
    DocumentRoot /var/www/subdomain.domain.be
    ErrorLog ${APACHE_LOG_DIR}/subdomain.domain.be.error.log
    CustomLog ${APACHE_LOG_DIR}/subdomain.domain.be.access.log combined

    SSLEngine on
    SSLCertificateFile /etc/cloudflare/path-to-cloudflare.pem
    SSLCertificateKeyFile /etc/cloudflare/path-to-cloudflare.key
</VirtualHost>

我尝试更改永久链接设置,删除.htaccess文件(保存后将其重新生成),. htaccess的权限为644..

I tried change permalink settings, deleting the .htaccess file (on save it regenerated it), the permissions of the .htaccess is 644..

一切对我来说看起来不错,但是不是吗?有小费吗?预先感谢!

Everything looks good to me, yet it isn't? Any tips? Thanks in advance!

推荐答案

DocumentRoot /var/www/wp-root-path

<Directory /var/www/wp-root-path>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
<FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>

您的< VirtualHost *:443> 容器似乎缺少必要的配置指令的一半?

Your <VirtualHost *:443> container seems to be missing half the necessary config directives?

您的vHost:443容器设置了其他 DocumentRoot 吗?您还无法在vHost:443容器中不允许 .htaccess 覆盖,因此任何漂亮"的内容都会被覆盖.永久链接将失败(404).而且您也不允许访问.

Your vHost:443 container is setting a different DocumentRoot? You are also failing to allow .htaccess overrides in the vHost:443 container so any "pretty" permalinks are going to fail (404). And you are not permitting access either.

我假设您使用的是Apache 2.4(而不是Apache 2.2),因此您应该使用 Require all grant ,而不是已弃用的 Order Allow指令.

I would assume you are on Apache 2.4 (not Apache 2.2), so you should be using Require all granted, instead of the deprecated Order and Allow directives.

您还缺少vHost:443容器中的 SetHandler 指令吗?

You are also missing the SetHandler directive in the vHost:443 container?

这篇关于WordPress的.htaccess代理奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆