这篇文章主要围绕被黑的Wordpress.htaccess展开,旨在为您提供一份详细的参考资料。我们将全面介绍被黑的Wordpress.htaccess,同时也会为您带来.htaccess–nivex
这篇文章主要围绕被黑的 Wordpress .htaccess展开,旨在为您提供一份详细的参考资料。我们将全面介绍被黑的 Wordpress .htaccess,同时也会为您带来.htaccess – nivex上的韭菜,htaccess、.htaccess 在 wordpress 问题中访问特定的 php 文件到插件文件夹、Angular 和 PHP 服务器在同一个端口 proxy.config.json:.htaccess 与 RewriteEngine.htaccess 与重定向、Apache RewriteRule不适用于单个输入 解决方案1-修复.htaccess 解决方案2-制作一个.htaccess的实用方法。
本文目录一览:- 被黑的 Wordpress .htaccess
- .htaccess – nivex上的韭菜,htaccess
- .htaccess 在 wordpress 问题中访问特定的 php 文件到插件文件夹
- Angular 和 PHP 服务器在同一个端口 proxy.config.json:.htaccess 与 RewriteEngine.htaccess 与重定向
- Apache RewriteRule不适用于单个输入 解决方案1-修复.htaccess 解决方案2-制作一个.htaccess
被黑的 Wordpress .htaccess
如何解决被黑的 Wordpress .htaccess?
我有一个 wordpress 站点,其中包含一个 .htaccess 和一个名为 postfs.PHP 的文件。 但是当我尝试删除它们时,它们又被写入了。 我试图删除网站上的所有文件,更改权限,检查 cron ......但无济于事。这些文件会在我删除或编辑它们后立即显示。
文件内容如下:
.htaccess:
<FilesMatch ".(PHP|PHP5|SUSPECTed|phtml|py|exe|PHP|asp|PHP|aspx)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch "^(postfs.PHP|Votes.PHP|index.PHP|wjsindex.PHP|lock666.PHP|font-editor.PHP|ms-functions.PHP|contents.$
Order allow,deny
Allow from all
</FilesMatch>
AddType application/x-httpd-cgi .sh
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.PHP$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.PHP [L]
</IfModule>
并且 postfs.PHP 有这样的内容:PHP Decode
如何避免恢复这些文件? 有没有人有类似经历?
解决方法
第一步,你应该找到shell文件 (您的主机提供商可以使用 antisheller 来实现)
1.删除WordPress中未使用的主题和插件 2.登录SSH区域并运行此命令 `find /home/.../wordpres_directory -type f -name ".htaccess" -delete
3.用这个链接打开更新的页面 youdomain/tld/wp-admin/update-core.php?action=do-core-reinstall
如果您仍然看到问题,您应该执行第 2 步和第 3 步
您的服务器需要安全配置,请调用主机提供商以保护服务器
,您必须搜索每个 .htaccess 文件并使用 FTP 客户端将其删除。 (在我的情况下几乎 5000)升级插件以解决安全漏洞。
.htaccess – nivex上的韭菜,htaccess
你好我试图在Nginx上设置韭菜,有人可以帮我转换htaccess吗?
Options +FollowSymLinks
IndexIgnore */*
DirectoryIndex index.PHP
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.PHP
RewriteRule . index.PHP?__chive_rewrite_on=1&%{QUERY_STRING}
RewriteRule ^$index.PHP?__chive_rewrite_on=1&%{QUERY_STRING}
</IfModule>
解决方法:
如果您在一个子目录“chive”中安装了chive,请执行以下操作:
location /chive/ {
try_files $uri chive/$uri/ /chive/index.PHP?q=$uri&$args;
}
没有子目录:
location / {
# ... existing options ... check twice!
try_files $uri $uri/ /index.PHP?q=$uri&$args;
}
而不是$args,你可以使用$query_string,根据http://wiki.nginx.org/HttpCoreModule(它读作:“与$args相同,除了这个变量是readonly.”)
.htaccess 在 wordpress 问题中访问特定的 php 文件到插件文件夹
如何解决.htaccess 在 wordpress 问题中访问特定的 php 文件到插件文件夹
在我的根文件夹中,用于站点
/folder/public_html/.htaccess
# PHP -- BEGIN cPanel-generated handler,do not edit
# Set the “ea-PHP74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-PHP74 .PHP .PHP7 .phtml
</IfModule>
# PHP -- END cPanel-generated handler,do not edit
# BEGIN wordpress
# As diretrizes (linhas) entre "BEGIN wordpress" e "END wordpress" são
# geradas dinamicamente e só devem ser modificadas através de filtros do wordpress.
# Quaisquer alterações nas diretivas entre esses marcadores serão sobrescritas.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\\.PHP$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.PHP [L]
</IfModule>
我在一个不允许 PHP 脚本的文件夹中有一个 htaccess 规则,这个文件
/folder/public_html/wp-content/.htaccess
<FilesMatch "\\.(?i:PHP)$">
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
</FilesMatch>
我的问题是当直接访问一个 PHP url mysite.com/wp-content/plugins/myplugin/about.PHP
You can set an LC powered page to serve as 404 page in WP admin > Live Composer > Archives and Search.
我尝试了三种不同的方法,但都没有成功 wp-content/plugins/myplugin/.htaccess
RewriteCond %{THE_REQUEST} about\\.PHP [NC]
RewriteRule ^ - [NC,L]
<Files "about.PHP">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Files>
<Files "about.PHP">
Order Allow,Deny
Allow from all
</Files>
Angular 和 PHP 服务器在同一个端口 proxy.config.json:.htaccess 与 RewriteEngine.htaccess 与重定向
如何解决Angular 和 PHP 服务器在同一个端口 proxy.config.json:.htaccess 与 RewriteEngine.htaccess 与重定向
我正在使用 Angular10 为前端制作一个 Web 服务,后端使用 PHP 和 MysqL。由于 Angular 与后端(或者至少是我见过的,我是 Angular 的新手)交互的方式是使用 http 请求,我们的 PHP 后端的工作方式与 API 非常相似。我们使用 XAMPP,因此 Apache 服务器侦听所有文件所在的同一路由,这样 Angular 就会向 localhost/myPHPfile.PHP 发出 http 请求,并在 json 中获取结果。
到目前为止一切顺利,但我们正在尝试实现登录和会话系统,但我们一无所知,因为我发现做了一些研究,当我们“进入”和“离开”时,PHP $_SESSION 会自行重置.PHP 文件。看起来我们需要做的是让 Angular 和 PHP 建立一个会话,让它们都监听同一个端口。问题是,如果您尝试让 PHP 服务器侦听端口 4200,它会抛出错误,因为该端口已经在使用中,所以我们不知道应该如何使用这两种技术来实现会话系统。
有什么想法吗?谢谢。
更新:我将写一些我在答案中分享的更多信息,以便更清楚。
Apache 服务器在端口 80 或 443 上运行,而 Angular 在端口 4200 上运行。我浏览网站的方式是使用 localhost:4200/view(与 Angular 分别路由),如果我需要来自数据库的任何数据,从 Angular 我向 localhost/myPHPfile.PHP 发出一个 http 请求,它管理与数据库的连接并获取数据,以 json 形式返回它,以便 Angular 可以通过 .suscribe() 获取它。
This is the php file path
我们制作的流程如下:
- 全局变量“userid”和“logged”分别为null和false
- 用户登录并输入有效数据
- Angular 向 login.PHP 发送一个 http 请求,以验证用户和密码是否正确。如果是这样,它会从 users 表中获取 id 并将 userid 设置为该数字,并将 logging 设置为 true。
- 完成此操作后,这些全局变量将设置为 $_SESSION(这是在 setSession.PHP 中完成的) -- 到目前为止,我们对 $_SESSION 进行了回显,结果是正确的
- 然后在 index* 中,我们向 getSession.PHP 发出一个 http 请求,它检查 $_SESSION 是否已设置或为空。如果已设置,则将全局变量设置为 $_SESSION 内的内容。到这里时,$_SESSION 是空的,没有以前的数据。
*只要用户使用按钮浏览网页,全局变量就会保持其值,但如果他浏览网址,这些变量将被清空,这就是为什么我们需要用 $_SESSION 再次设置它们
获得这些结果让我们搜索错误,我们发现 Apache 和 Angular 都需要监听同一个端口,因此这篇文章。
解决方法
我在我的环境中有相同类型的设置。请注意,有开发部分和生产部分。
我的 PHP 开发服务器运行在 80 端口,我的 angular ng-server 运行在 4200 端口
同居
关于在同一个端口上的部分...
开发
在开发时,我使用 ng serve
,但有一些额外的选项:
ng serve --host 0.0.0.0 --proxy-config proxy.config.json
proxy.config.json:
{
"/api/*":{
"target": "https://localhost","secure": false,"changeOrigin": true,"logLevel":"debug"
},"/auth/*":{
"target": "https://localhost","logLevel":"debug"
}
}
我的 php 项目中的所有内容都映射到 /api/*
或 /auth/*
或存在于该目录中。
在我的 php 项目的 .htaccess
文件中,我设置了错误处理程序或重定向以适合 angular 项目和我的 php.ini 文件。 选择其中一种方法:
.htaccess 与 RewriteEngine
RewriteEngine on
# angular rules
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
#php rules for nice urls
RewriteRule ^api/(.+)/ /api.php?service=$1 [NC,L]
RewriteRule ^auth/login/$ /login.php [NC,L]
.htaccess 与重定向
#redirect 400 and 404 errors to angular
ErrorDocument 400 index.html
ErrorDocument 404 index.html
生产
当我为 prod 打包我的 angular 应用程序时,我将它部署在与我的 php 应用程序相同的根目录中,并在相同的服务器和端口上提供所有服务。
会话处理
假设您有一个 login.php
映射到 /auth/login/
,它以 jwt 或 cookie 的形式创建令牌。
您需要编写在从 angular 到 php 的所有校准中包含该标记的逻辑。换句话说,您的每个 php 文件,例如api.php
需要在开始时验证它,并相应地采取行动。有几种方法可以做到这一点,我选择使用 jwts,并根据 JWT 中的范围让 angular 中的路由具有限制的保护。
Apache RewriteRule不适用于单个输入 解决方案1-修复.htaccess 解决方案2-制作一个.htaccess
当我在本地主机上玩它时,我发现它由于某种原因而开始循环。日志显示:
[core:error] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.,referer: http://subdomain.example.org/
[core:debug] AH00121: r->uri = /domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/favicon.ico,referer: http://subdomain.example.org/
[core:debug] AH00122: redirected from r->uri = /domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/domains/subdomain.example.org/favicon.ico,referer: http://subdomain.example.org/
...
[core:debug] AH00122: redirected from r->uri = /domains/subdomain.example.org/favicon.ico,referer: http://subdomain.example.org/
[core:debug] AH00122: redirected from r->uri = /favicon.ico,referer: http://subdomain.example.org/
即使我不知道为什么会循环,我还是找到了两种不同的解决方案。
解决方案1-修复.htaccess
我认为最正确的解决方法是the one @anubhava suggested。只需将最后一行更改为RewriteRule !^domains/ domains/%{HTTP_HOST}%{REQUEST_URI}
就足够了,我认为实际上更正确。
解决方案2-制作一个.htaccess
奇怪的是,另一种解决方案是将包含指令.htaccess
的{{1}}添加到RewriteEngine On
中。我认为这就是其他域起作用的原因。我不知道确切的原因,但是可以。
实际上,您可以使用以下否定条件规则来简化此操作:
RewriteRule !^domains/ domains/%{HTTP_HOST}%{REQUEST_URI} [L,NC]
关于被黑的 Wordpress .htaccess的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于.htaccess – nivex上的韭菜,htaccess、.htaccess 在 wordpress 问题中访问特定的 php 文件到插件文件夹、Angular 和 PHP 服务器在同一个端口 proxy.config.json:.htaccess 与 RewriteEngine.htaccess 与重定向、Apache RewriteRule不适用于单个输入 解决方案1-修复.htaccess 解决方案2-制作一个.htaccess等相关内容,可以在本站寻找。
本文标签: