Htaccess for Domain move

Posted on 2011-03-23
Last Modified: 2012-05-11

 I would like to move my existing site to a new domain. I need a 301 permanent move for all urls to new corresponding urls.{some-url}

under folder all urls will be directed to{some-url}



How should we write that htaccess file to achive this result?
Question by:mescalin

Expert Comment

ID: 35202456
LVL 13

Expert Comment

ID: 35202799
Just place the .htaccess file inside the directory of  forum of olddomain ( ) with the following contents.

Redirect 301 /forum{some-url}

For{some-url} , place .htaccess with the following content inside the directory portal.

Redirect 301 /portal{some-url}

Let me know if you face any difficulty.

Author Comment

ID: 35203621

 Thank you for the reply but {some url} part is also important because i have 200k pages and when user hits any url in the old domain it should write exact same url for the new domain. I wont write {some url} it should generate it. is it possible?
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

LVL 11

Accepted Solution

Murfur earned 500 total points
ID: 35205674
Assuming the folders and files are as they were on the old server then this should transfer every request to the new server:

RewriteEngine On
RewriteRule ^(.*)$$1 [R=301,L]

Open in new window

LVL 13

Expert Comment

ID: 35212169
Sorry for my late reply. I was away. Glad to know the rewrite rule works fine for you.

LVL 31

Expert Comment

ID: 35212577

RewriteEngine On
RewriteRule ^*)$$1 [R=301,L]

Open in new window


Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP installation issues 11 59
How to send multiple emails at the same time in PHP 12 57
PHP Sessions in WordPress 8 29
ignore other .htaccess 2 43
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now