在我的网站上,所有的图像/样式表在/ 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开始
发布评论