简体   繁体   English

htaccess将html转换为php

[英]htaccess rules html to php

I want to be able to redirect folders and subfolders (all html) to another server with different folders (php) 我希望能够将文件夹和子文件夹(全部html)重定向到具有不同文件夹(php)的另一台服务器

I have a domain with DNS redirects Cname and A field pointing the domiain (that has not changed) to new website using php. 我有一个使用DNS的域重定向Cname和一个使用php将domiain(尚未更改)指向新网站的字段。

So, I want to do the following as an example. 因此,我想以以下示例为例。

On the old server 在旧服务器上

http://www.domain.co.uk/folder1/subfolder1/page.html http://www.domain.co.uk/folder1/subfolder1/page.html

to go to 要去

New server 新服务器

http://www.domain.co.uk/folder3/ http://www.domain.co.uk/folder3/

The domain used to point at the htdocs folder on the first server but now using CNAME and an A field it points to the second (new) server 该域曾经指向第一台服务器上的htdocs文件夹,但现在使用的是CNAME和一个A字段,它指向第二台(新)服务器

Can I just redirect bulk folders to the new folders? 我可以将批量文件夹重定向到新文件夹吗?

Hope this makes sense 希望这有意义

Richard 理查德

You can redirect bulk folders. 您可以重定向批量文件夹。

RewriteEngine On    
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.otherdomain.com/$1 [R=301,L]

This is a simple code that redirects ftm domain.com to otherdomain.com. 这是一个简单的代码,可将ftm domain.com重定向到otherdomain.com。 But if you want to change folder1/folder2 to folder3, well.... just think you could you possibly shrink that to a simple rule? 但是,如果您想将folder1 / folder2更改为folder3,.......以为您可以将其缩小为一个简单的规则? I think below 50 pages you better off wiriting 301 redirects line by line. 我认为在50页以下时,最好逐行编写301重定向。 Otherwise, no short way. 否则,没有捷径可走。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM