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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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?
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

730 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