mercredi 26 juin 2019

Absolute Path redirection using .htaccess when shifting from one shared Linux cpanel web hosting to another

Absolute Path redirection using .htaccess when shifting from one shared Linux cpanel web hosting to another

I have shifted my hosting from one hosting to another. I am attempting to redirect the absolute path of old server with the absolute of new one.

There are many includes in the script, which calls for a php or html file using include(" ");. Example: /home/cpanel-username/public_html/domainname.com/templates/default/filename.php

I am trying to redirect files such as the above with the new server absolute path. Example: /home2/new-cpanel-username/public_html/same-domainname.com/templates/default/same-filename.php.

I have made an attenmpt as below.

RewriteEngine On RewriteCond %{REQUEST_URI} ^/home/username/public_html/domainname.com/templates/default/ RewriteRule ^(.*)/.php /home2/new-server-username/public_html/same-domainname.com/templates/default/$2 [L,R=301]

The above redirect is for .php file. There are so many other such files with extensions .php and .html. Hence, I am unable to change the old absolute path with new one individually through notepad edit.

The above code is not working. Any help?




Aucun commentaire:

Enregistrer un commentaire