Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

Htaccess for Domain move


 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?
1 Solution
LinuxGuruLinux Server AdministratorCommented:
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.
mescalinAuthor Commented:

 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?
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

MurfurFull Stack DeveloperCommented:
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

LinuxGuruLinux Server AdministratorCommented:
Sorry for my late reply. I was away. Glad to know the rewrite rule works fine for you.


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

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now