.htaccess - htaccess 内部屏蔽重定向
问题描述
我一直在寻找如何说www.xyz.com/payroll来加载 www.xyz.com/react 的内容,同时仍然在地址栏中显示www.xyz.com/payroll
到目前为止,我只有一个基本重定向,它将地址栏中的 URL 更改为 xyz.com/react:
RewriteEngine On
RewriteRule ^payroll/?$ /react [L]
`# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteRule .* - [E=W3TC_SSL:_ssl]
RewriteCond %{SERVER_PORT} =443
RewriteRule .* - [E=W3TC_SSL:_ssl]
RewriteCond %{HTTP:X-Forwarded-Proto} =https [NC]
RewriteRule .* - [E=W3TC_SSL:_ssl]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
RewriteRule .* - [E=W3TC_PREVIEW:_preview]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond %{REQUEST_URI} \/$
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN (mt) controlled settings
AddHandler php-latest .php
# END (mt) controlled settings
`
htaccess 中已经有以下代码:
解决方案
推荐阅读
- flutter - 在文本字段顶部的 fireOS firetv/firestick 上颤振文本字段
- protractor - 使用前摄器运行 e2e 测试用例并且未创建会话
- javascript - JQuery AJAX - 将数据从表单传递到 PHP 脚本
- ruby-on-rails - Rails - 为调试、信息和错误配置单独的日志文件
- python - python中的SQL COALESCE()方法
- c# - Xamarin Form setter FontFamily 在同一文件主题中引用自定义字体
- scala - 通过 UDF、Spark - Scala 加密 CSV 列
- r - 如何在 R 中操作配对数据集?
- .net - 是否有 dotnet 命令可以下载任意 NuGet 包而不将其作为依赖项添加到任何 .NET 项目中?
- git - Git Diff如何报告空行中的差异