我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Apache Rewrite如何通过替换部分来重定向url?

Take this url for example:

 www.mysite.com/old/blablabla/some.html

I want to replace any request uri starting with /old/ with /new/old/. Then that sample should be

 www.mysite.com/new/old/blablabla/some.html

I tried this but I got 404:

RewriteCond %{REQUEST_URI} ^/old/
RewriteRule ^/old/(.*)$ /new/old/$1 [L]

Just with this:

RewriteRule ^/old/(.*) /new/old/$1 [L]

but /new/old/blablabla/some.html has to exist phisicaly in your server path.

近期文章

  • PHP页面没有更新MySQL数据
  • Symfony:kernel-> loadClassCache和多个渲染控制器
  • 如何访问与另一个表Laravel 5.1相关的一列
  • 每月获取WordPress帖子
  • 网站上的间歇性502错误
  • PHP将阿拉伯语文本转换为图像
  • 在Blade中使用Sessions显示空白页面
  • 来自网格的PHP多方向数组
  • 如何建立捆绑依赖项?
  • 解析用户详细信息失败
  • 在php的下一页中发布id
  • 使用PHP解析xml caaml文件
  • 如何从XML文件中的每个<description>获取第一个<p>?
  • 如何在PHP中返回字符串时包含变量?
  • 如何在Google Container Engine上安装Wordpress更新?
  • 提交带有文件上传的表单不会在post变量中发送提交
  • Google Cloud SQL无法添加授权的App Engine应用程序
  • Cookie没有用PHP编写,即使它显示在Response标头中
  • 复制MySQL中第二个数据库中第一个数据库的一列
  • 查询MySQL数据库以使用PHP显示英国邮政编码的某个半径范围内的属性

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华