regex - 使用内部重定向重写漂亮的 url
问题描述
我正在尝试通过内部重定向来设置一个漂亮的 url
http://test.agency.com/private
,
http://test.agency.com/index.html?//private
当我给R我的 htaccess 是
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} "^$"
RewriteRule ^(.*)$ /index.html?//$1 [QSA,L,R]
当它尝试维护漂亮的 url 并使用内部重定向时
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} "^$"
RewriteRule ^(.*)$ /index.html?//$1 [QSA,L,P]
它不工作,这些是我得到的日志
strip per-dir prefix: /var/www/html/agencytest/private ->
private
[perdir /var/www/html/agencytest/] applying pattern '^(.*)$' to
uri
'private'
[perdir /var/www/html/agencytest/] rewrite 'private' ->
'/index.html?//private'
split uri=/index.html?//private -> uri=/index.html, args=//private
[perdir /var/www/html/agencytest/] escaped URI in per-dir context
for
proxy, /index.html -> /index.html
[perdir /var/www/html/agencytest/] forcing proxy-throughput with
http://agencytest.vignets.com/index.html
[perdir /var/www/html/agencytest/] go-ahead with proxy request
proxy:http://agencytest.vignets.com/index.html?//private [OK]
[perdir /var/www/html/agencytest/] strip per-dir prefix:
/var/www/html/agencytest/index.html -> index.html
[perdir /var/www/html/agencytest/] applying pattern '^(.*)$' to
uri
'index.html'
[perdir /var/www/html/agencytest/] pass through
/var/www/html/agencytest/index.html
请注意private
可以是任何字符串
解决方案
推荐阅读
- sql - SQL Server 查询以提取所有行
- uwp - DeviceCodeProvider 在哪里?
- javascript - 当页面完成加载时,我如何使我的模态 jquery 加载
- javascript - 用户通过命令行在 node.js 中输入数组
- reactjs - 未找到模块 - 在 NextJS 中导入 svg
- c# - 与提示输入凭据的 Dynamics 365 Online Web API 集成
- azure-devops - Power BI 测试报告:没有错误的测试运行失败
- angular - Formio:如何向 html 元素添加工具提示?
- mysql - Laravel 允许 Model::create() 上的空日期但不允许 Model->update()
- scala - 列表的类型别名在擦除后导致相同的类型