Htaccess redirect to another folder on the same domain

I have a website, I have saved all my files and folders. Now I created a folder called "newsite" and moved all the files there. Now I want my custom type in the browser to automatically redirect them to

I am using a linux server with godaddy hosting. I know it can be done via htaccess file. Can anyone help me with this?

I am using this in my htaccess file but it doesn't work

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)$ /newsite$1 [R,L]


Thank you so much in advance


source to share

3 answers

This should do it:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !^/newsite [NC]
RewriteRule ^ /newsite%{REQUEST_URI} [R=301,L]



checks if the url starts with /newsite

, if it doesn't redirect the user to it.



Try this solution:

RewriteRule ^xxx/?([^/].*)?$ old/xxx/$1 [L]



 RewriteRule ^(.*)directory(.*)$ $1otherdir$2 [QSA,L,R=301,NC]




Hello friend, that's right:

RewriteEngine On RewriteBase /

RewriteCond% {REQUEST_URI}! ^ / yournewfolder [NC] RewriteRule ^ / yournewfolder % {REQUEST_URI} [R = 301, L]

Only this in your .htacces which are in your public_html folder (site root)

New folder is the folder containing your site files. If you are using Wordpress, use Softaculous to clone all of your website content into a new folder.

Remember that you will need to change the information for your database. ... Log in to your phpMyAdmin account, export your database to a location on your computer (use the Custom option - display all possible options to export and save a backup of the exported database - if you miss anything, you will have this insurance file to import it again).

Then open yourdatabasename.sql file in your php editor, use the replace option and make the following changes:

(Change option to)

save the edited file. Now go back to your phpMyAdmin account and delete your old database (by selecting all tables and using the delete option), after deleting go to the Import option and import the new modified database.

Have a great day.



All Articles