When you create a redirect using cPanel's Redirect, it will add the directive to the .htaccess file.

But there are times redirects didn't work.

It might be because there is existing content within the .htaccess file.

 

The first thing to do is to list the content of the directory:

ls -lah public_html

cat public_html/.htaccess

Check to see if the content contains the redirect directive.

 

When a new hosting account is created, typically it will have the HTTP DCV .well-known directory and probably some other contents we place to get new accounts get started.

This should allow Apache to load the contents of the directory.

If these has been deleted but there is still an existing .htaccess config file, you can simply rename or move the .htaccess file before recreating the redirect.

You can do that with:

mv -v public_html/.htaccess public_html/.htaccess.orig

Or using the File Manager's Rename function.

Once that is done, scroll down to Domains.

Click on Redirects and select the redirect type.

The redirect type can be:

 

Permanent: redirect an entire site to $domain_name.com:

Redirect 301 / https://$domain_name.com/


Redirect a page to a different page on $domain_name.com:

Redirect 301 /original.html https://www.$domain_name.com/new.html


Redirect an entire directory to a different directory on $domain_name.com:

Redirect 301 /old-directory http://www.$domain_name.com/new-directory

 

 

Temporary: redirect an entire site to $domain_name.com:

Redirect 302 / https://$domain_name.com/


Redirect a page to a different page on $domain_name.com:

Redirect 302 /original.html https://www.$domain_name.com/new.html


Redirect an entire directory to a different directory on $domain_name.com:

Redirect 302 /old-directory https://www.$domain_name.com/new-directory


Select a domain.

Specify a protocol in this text box (http://, https://, or ftp://).

Make other selections and then Click Add to recreate it.

Visit your browser and test the changes.


If you simply want to redirect a domain where the original domain is retained in the browser's address bar, create an addon domain instead.

And then redirect it to the chosen domain.

This can be done via cPanel>> Domains >> Addon Domains.

To redirect visitors from the insecure version of the website to the secure version, use the Force HTTPS Redirect option at cPanel >> Domains.

?האם התשובה שקיבלתם הייתה מועילה 0 משתמשים שמצאו מאמר זה מועיל (0 הצבעות)