URL重写添加目录的URL开始

编程入门 行业动态 更新时间:2024-10-10 08:27:30
本文介绍了URL重写添加目录的URL开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的网站上,所有的图像/样式表在/ CMS / ...目录。最近,我们的网站转移到新的服务器,在那里他们引用的是/ newdirectory / CMS /...

On my website, all images/stylesheets are in the /CMS/... directory. Recently, our website shifted to new server at a temporary url where they referenced like /newdirectory/CMS/...

我们如何追加/ newdirectory /所有/ CMS /电话?

How can we append /newdirectory/ to all /CMS/ calls?

推荐答案

在的.htaccess 文件

RewriteEngine On RewriteCond %{REQUEST_URI} !^/newdirectory/CMS/ RewriteRule ^(.*)$ /newdirectory/CMS/$1

这将执行重写,所以访问的 www.server/CMS/index.html 的实际上将服务于的 HTTP内容://www.server。 COM / newdirectory / CMS / index.html的的

This will perform a rewrite, so accessing www.server/CMS/index.html will actually serve the content of www.server/newdirectory/CMS/index.html

注:该解决方案假定CMS是被服务这个领域的唯一的事情

Note: This solution assumes that the CMS is the only thing being served for this domain.

如果这个域比CMS在职(只有CMS应该转),那么下面可能会更好:

If this domain is serving more than the CMS (and only the CMS should be redirected), then the following may be better:

RewriteEngine On RewriteCond %{REQUEST_URI} ^/CMS/ RewriteRule ^(.*)$ /newdirectory/$1

更多推荐

URL重写添加目录的URL开始

本文发布于:2023-11-01 11:16:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549190.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   目录   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!