@delpha
To redirect properly using .htaccess, you can use the following methods:
1
|
Redirect /old-page.html http://example.com/new-page.html |
This will redirect the URL "/old-page.html" to "http://example.com/new-page.html".
1
|
Redirect 301 / http://newdomain.com/ |
This will redirect all requests to the old domain to the new domain with a 301 status code (permanent redirect).
1 2 3 |
RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] |
This will redirect requests from "www.example.com" to "example.com" or vice versa using a 301 status code.
1 2 |
RewriteEngine On RewriteRule ^old-page.html$ /new-page.html [R=301,L] |
This will redirect the URL "/old-page.html" to "/new-page.html" using a Rewrite rule and a 301 status code.
Note: Make sure to backup your .htaccess file before making any changes and test the redirects to ensure they are working as expected.