如何解决主文件夹中的 Joomla 和子文件夹中的 wordpress 会产生重写问题
在 Joomla 网站运行数月后,我的客户希望为仅支持 wordpress 的“驾驶学校”进行特定集成。所以我安装(上传)一个 wordpress 到一个子文件夹中。棘手的部分是“驾驶学校”集成是需要安装的 2 个插件(也有重写)——我也这样做了。这两个插件被称为: 中频底座 MF STR 网店 这些插件会创建 .htaccess (wordpress) 的输入 - 请参阅 Joomla 下面的 .htaccess for wordpress。
- 主站点 (Joomla):https://www.mainsite.se
- 子文件夹:e-handel
- wordpress 网站:https://www.mainsite.se/e-handel
我知道访问和编辑 wordpress 安装有很多问题。
据我所知,Joomla .htaccess 文件是“标准 joomla”,“在 Joomla 内”一切正常:
# @package Joomla
# @copyright copyright (C) 2005 - 2020 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
# It is required for the use of Apache mod_rewrite,but it may have already been set by
# your server administrator in a way that disallows changing it in this .htaccess file.
# If using it causes your site to produce an error,comment it out (add # to the
# beginning of the line),reload your site in your browser and test your sef urls. If
# they work,then it has been set by your server administrator and you do not need to
# set it here.
##
## No directory listings
<IfModule mod_autoindex.c>
IndexIgnore *
</IfModule>
## Suppress mime type detection in browsers for unkNown types
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>
## Can be commented out if causes errors,see notes above.
Options +FollowSymlinks
Options -Indexes
## disable inline JavaScript when directly opening SVG files or embedding them with the object-tag
<FilesMatch "\.svg$">
<IfModule mod_headers.c>
Header always set Content-Security-Policy "script-src 'none'"
</IfModule>
</FilesMatch>
## Mod_rewrite in use.
RewriteEngine On
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root home page
RewriteRule .* index.PHP [F]
#
## End - Rewrite rules to block out some common exploits.
## Begin - Custom redirects
#
# KJEKOR ADDED LInes FOR NON-WWW AND HTTPS
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [END,R=301]
# If you need to redirect some pages,or set a canonical non-www to
# www redirect (or vice versa),place that code here. Ensure those
# redirects use the correct RewriteRule Syntax and the [R=301,L] flags.
## End - Custom redirects
##
# Uncomment the following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.PHP and the request
# has not already been internally rewritten to the index.PHP script
RewriteCond %{REQUEST_URI} !^/index\.PHP
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.PHP script
RewriteRule .* index.PHP [L]
#
## End - Joomla! core SEF Section.
问题出在 wordpress 中 - 以及子文件夹中的安装。 带有 wordpress 的子文件夹具有下面的 .htaccess。 我自己添加的前 2 行希望排除 wordpress 登录和管理。 但他们似乎并没有为我做这件事。它确实帮助我获得了登录页面,但它需要很长时间才能打开。此外,我无法打开页面进行编辑(说明“资源限制”),并且似乎陷入循环或其他问题。
我也没有能力理解“MF Base”和“MF STR Webshop”(包含在用于网上商店集成的 2 个插件中)这几行实际上在做什么。
# BEGIN MF STR Webshop (a65702ca1fdf0422f4eee26733d3b104)
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !wp-admin
RewriteCond %{REQUEST_URI} !wp-login.PHP$ [NC]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/e-handel/$
RewriteCond %{REQUEST_URI} ^/e-handel/(.*)$
RewriteRule (.*) /e-handel/wp-content/plugins/mf_str_webshop/view/ [L]
</IfModule>
# END MF STR Webshop
# BEGIN MF Base (87be7abd683588a0797e27d572e3efaa)
ServerSignature Off
DirectoryIndex index.PHP
Options -Indexes
Header set X-XSS-Protection "1; mode=block"
Header set X-Content-Type-Options nosniff
Header set X-Powered-By "Me"
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteRule ^my_ip$ /e-handel/wp-content/plugins/mf_base/include/my_ip/ [L]
RewriteCond %{REQUEST_URI} ^/?(wp\-content/+debug\.log|license\.txt|readme\.html|wp\-config\.PHP|wp\-config\-sample\.PHP)$
RewriteRule .* /404/ [L,NC]
</IfModule>
# END MF Base
# BEGIN wordpress
# Direktiven (raderna) mellan ”BEGIN wordpress” och ”END wordpress” är
# dynamiskt genererade och bör endast ändras via wordpress-filter.
# Eventuella ändringar av direktiven mellan dessa markörer kommer att skrivas över.
# END wordpress
希望得到帮助! 我真的希望你们能帮助我纠正 Joomla/Main 文件夹和 WP/subfolder 的 .htaccess 或重写规则。当有人能够帮助我时,我可以提供实际的 URL
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。