Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess 301 redirect url

I have a small dilemma.

I have been working on a project for almost a year now and had an old domain name. Not knowing how Google has indexed the whole site under the old domain which has worried me. I want to put the site up on my new domain name and I think doing a 301 is the way forward. I will need to do this on every dynamic page. The good thing is the page structure is identical.

Any advice on the best way to do this would be massively appreciated.

like image 438
richard grantham Avatar asked Dec 10 '22 07:12

richard grantham


1 Answers

The best way is to create a .htaccess file if you don't have one already and stick it in your html folder.

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule ^old/page new/page [R=301,L] #can copy and paste this as many times as needed

</IFModule>
like image 131
switz Avatar answered Jan 01 '23 12:01

switz