0

I'm migrating a website from an old server and after I uploaded all the files and connect the database, the dynamic content on pages is giving me a 404 error.

The old server was managed with Nginx, the new server is using Nginx-Hybrid so I can use the .htaccess file.

In my opinion, the .htaccess needs a special configuration but I haven't found a solution yet.

Can someone please give me an advice?

Here is an example of the production site pages:

https://www.arecontvision.com/index.php
https://www.arecontvision.com/Company/about-arecont
https://www.arecontvision.com/products/SurroundVideo+Omni+G2+Series
https://www.arecontvision.com/pressreleasedetails/Arecont+Vision+ConteraIP%E2%84%A2+Multi-Sensor+Camera+Named+2018+Campus+Safety+BEST+Winner

Here is the new site I'm working on:

https://sales.arecontvisioncostar.com/index.php
https://sales.arecontvisioncostar.com/Company/about-arecont
https://sales.arecontvisioncostar.com/products/SurroundVideo+Omni+G2+Series
https://sales.arecontvisioncostar.com/pressreleasedetails/Arecont+Vision+ConteraIP%E2%84%A2+Multi-Sensor+Camera+Named+2018+Campus+Safety+BEST+Winner
Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
  • 1
    what did you try? – Gufran Hasan Oct 18 '18 at 20:07
  • There any URL rewriting going on? Confused. It's just the subdomain/URI change? Can you reach the index page or is everything a 404? – ficuscr Oct 18 '18 at 20:08
  • Have you tried it https://serverfault.com/questions/139579/nginx-subdomain-rewrite – Gufran Hasan Oct 18 '18 at 20:10
  • there are many posts available URL rewriting https://stackoverflow.com/questions/15266253/nginx-rewrite-all-wildcard-subdomains-to-www-site-com – Gufran Hasan Oct 18 '18 at 20:17
  • No, there isn't a rewriting right now. The htaccess is blank at the moment. Yes, I can reach the index page and pages ending on .php Eg: https://sales.arecontvisioncostar.com/categories.php – Esteban Gallego Oct 18 '18 at 20:18
  • I just copy the old's site Nginx configuration below and I believe the "location @handler" is where the rewrite is made for those pages. Since I can't change the Nginx config on the new server, I may need to translate it from Nginx to .htacess the section "location @handler". https://gist.github.com/estebangallego/4e8b04408044c44f3dd9a91974348444. Please take a note that the URL is changing to sales.arecontvisioncostar.com – Esteban Gallego Oct 18 '18 at 21:03

1 Answers1

0

The .htaccess code for redirecting an old domain (old.com) to a new domain (new.com).

RewriteCond %{HTTP_HOST} ^old.com
RewriteRule (.*) http://www.new.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.old\.com
RewriteRule (.*) http://www.new.com/$1 [R=301,L]

OR

RewriteEngine on
RewriteCond %{HTTP_HOST} ^arecontvision.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.arecontvision.com [NC]
RewriteRule ^(.*)$ http://sales.arecontvisioncostar.com/$1 [L,R=301,NC]

or another way you can redirect permanently 301

Redirect 301 https://www.arecontvision.com/index.php https://sales.arecontvisioncostar.com/index.php
Redirect 301 https://www.arecontvision.com/Company/about-arecont https://sales.arecontvisioncostar.com/Company/about-arecont
Redirect 301 https://www.arecontvision.com/products/SurroundVideo+Omni+G2+Series https://sales.arecontvisioncostar.com/products/SurroundVideo+Omni+G2+Series
Redirect 301 https://www.arecontvision.com/pressreleasedetails/Arecont+Vision+ConteraIP%E2%84%A2+Multi-Sensor+Camera+Named+2018+Campus+Safety+BEST+Winner https://sales.arecontvisioncostar.com/pressreleasedetails/Arecont+Vision+ConteraIP%E2%84%A2+Multi-Sensor+Camera+Named+2018+Campus+Safety+BEST+Winner
Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
  • Are you using wordpress or php only? – Gufran Hasan Oct 18 '18 at 20:16
  • please try this RewriteEngine on RewriteCond %{HTTP_HOST} ^arecontvision.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.arecontvision.com [NC] RewriteRule ^(.*)$ http://sales.arecontvisioncostar.com/$1 [L,R=301,NC] – Gufran Hasan Oct 18 '18 at 20:23
  • It's a PHP site. And, is the tags for this rewire correctly: ? – Esteban Gallego Oct 18 '18 at 20:25
  • okay, please see it https://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess – Gufran Hasan Oct 18 '18 at 20:26
  • I'm not trying to redirect the pages to the old website. The code above didn't work. To be more specific all the pages ending with PHP are working properly but the Dynamic pages with URLs like Company/.../ don't work. Also, I can't change the Nginx since I'm using RunCloud.io I only have access to .htacess – Esteban Gallego Oct 18 '18 at 20:42
  • I'm not doing a redirect, I just copy the old's site Nginx configuration below and I believe the "location @handler" is where the rewrite is made for those pages. Since I can't change the Nginx config on the new server, I may need to translate it from Nginx to .htacess the section "location @handler". gist.github.com/estebangallego/4e8b04408044c44f3dd9a91974348444. Please take a note that the URL is changing to sales.arecontvisioncostar.com – Esteban Gallego Oct 18 '18 at 21:33
  • See this solution https://www.saotn.org/ssl-wordpress-move-wordpress-site-https-definitive-guide/ – Gufran Hasan Oct 19 '18 at 10:37