简体   繁体   中英

htaccess rules html to php

I want to be able to redirect folders and subfolders (all html) to another server with different folders (php)

I have a domain with DNS redirects Cname and A field pointing the domiain (that has not changed) to new website using php.

So, I want to do the following as an example.

On the old server

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

to go to

New server

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

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. But if you want to change folder1/folder2 to folder3, well.... just think you could you possibly shrink that to a simple rule? I think below 50 pages you better off wiriting 301 redirects line by line. Otherwise, no short way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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