Your Cart

Get Amazing Offers on Scripts

Get UX Support

How to redirects domain URL’s with Nginx?

How to redirects domain URL’s with Nginx?

Redirecting domain URLs with Nginx involves setting up a server block to handle the redirection. Below are steps to configure basic domain redirection:

Consider you want to redirect Old URL to New URL

Old URL

				
					http://yourdomain.com/old-category/my-page-name
				
			

New URL

				
					http://yourdomain.com/new-category/my-page-name
				
			

Open the Nginx configuration file: The main configuration file is usually located at /etc/nginx/nginx.conf. However, it’s better to create or edit server-specific configuration files in the /etc/nginx/sites-available/ directory and create a symbolic link in the /etc/nginx/sites-enabled/ directory.

Inside Location: Add below configuration.

				
					 location / {

  if ( $request_filename ~ old-category/my-page-name/ ) {
   rewrite ^ http://yourdomain.com/new-category/my-page-name? permanent;
}

				
			

Still facing Issues ?

Contact me for paid support​ Mail me @ tutorialslides.com@gmail.com
Paid Support
Leave a Reply
Fast Download

Instant access to your digital products right after purchase.

Custom Softwares

Completely build by Tutorialslides

Latest Sofware Updates

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa